gridcli 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/gridcli/commands/friends.rb +5 -4
- data/lib/gridcli/pprinter.rb +3 -3
- data/lib/gridcli/version.rb +1 -1
- metadata +3 -3
@@ -2,6 +2,7 @@ module GridCLI
|
|
2
2
|
class FriendsCommand < BaseCommand
|
3
3
|
def initialize
|
4
4
|
super "friends", "List your friends or the friends of a friend"
|
5
|
+
add_format_option
|
5
6
|
end
|
6
7
|
|
7
8
|
def usage
|
@@ -10,7 +11,7 @@ module GridCLI
|
|
10
11
|
|
11
12
|
def run(args)
|
12
13
|
# handle options
|
13
|
-
username = @config['username']
|
14
|
+
username = (args.length == 0 or args.first.start_with?('-')) ? @config['username'] : args.shift
|
14
15
|
parse_opts args
|
15
16
|
|
16
17
|
begin
|
@@ -19,10 +20,10 @@ module GridCLI
|
|
19
20
|
friends.each { |f|
|
20
21
|
pprint f.user.to_json
|
21
22
|
}
|
22
|
-
puts "
|
23
|
+
puts "#{username} has no friends :(" if friends.length == 0
|
23
24
|
rescue ActiveResource::ForbiddenAccess
|
24
|
-
puts "Looks like '#{username}' isn't one of your friends."
|
25
|
-
rescue ActiveResource::
|
25
|
+
puts "Looks like '#{username}' isn't one of your friends, so you can't view #{username}'s friends."
|
26
|
+
rescue ActiveResource::ClientError
|
26
27
|
puts "Sorry, can't find a user with name '#{username}'"
|
27
28
|
end
|
28
29
|
end
|
data/lib/gridcli/pprinter.rb
CHANGED
@@ -30,15 +30,15 @@ module GridCLI
|
|
30
30
|
|
31
31
|
class PPCmdFormat
|
32
32
|
def self.like(original, parsed)
|
33
|
-
"on #{
|
33
|
+
"on #{parsed['created_at']} #{parsed['from_username']} liked #{parsed['body']}\n"
|
34
34
|
end
|
35
35
|
|
36
36
|
def self.dislike(original, parsed)
|
37
|
-
"on #{
|
37
|
+
"on #{parsed['created_at']} #{parsed['from_username']} disliked #{parsed['body']}\n"
|
38
38
|
end
|
39
39
|
|
40
40
|
def self.status(original, parsed)
|
41
|
-
"on #{
|
41
|
+
"on #{parsed['created_at']} #{parsed['from_username']} was #{parsed['body']}\n"
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.message(original, parsed)
|
data/lib/gridcli/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gridcli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 8
|
10
|
+
version: 0.0.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Muller
|