gridcli 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +3 -0
- data/lib/gridcli/commands/search.rb +5 -2
- data/lib/gridcli/storage/base.rb +1 -1
- data/lib/gridcli/storage/files.rb +10 -3
- data/lib/gridcli/version.rb +1 -1
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -28,6 +28,9 @@ To add a friend:
|
|
28
28
|
To list your friends:
|
29
29
|
grid friends
|
30
30
|
|
31
|
+
To list the friends of a friend:
|
32
|
+
grid friends <username>
|
33
|
+
|
31
34
|
== Messaging
|
32
35
|
To send a message to a list of users:
|
33
36
|
grid message <username>[,<username>,...] [-s <subject>] [-b <body>] [-f <body file>]
|
@@ -2,11 +2,14 @@ module GridCLI
|
|
2
2
|
class SearchCommand < BaseCommand
|
3
3
|
def initialize
|
4
4
|
super "search", "Search posts"
|
5
|
+
add_option("-u username", "--from-user username", "Only look at messages from a particular user.") { |u|
|
6
|
+
@opts['from'] = u
|
7
|
+
}
|
5
8
|
add_format_option
|
6
9
|
end
|
7
10
|
|
8
11
|
def usage
|
9
|
-
super "<like|dislike|message|status|all> <query> [<
|
12
|
+
super "<like|dislike|message|status|all> <query> [<exact day> | <start> to <end>]"
|
10
13
|
end
|
11
14
|
|
12
15
|
def run(args)
|
@@ -19,7 +22,7 @@ module GridCLI
|
|
19
22
|
parse_opts args
|
20
23
|
|
21
24
|
log "Showing #{type} posts in range #{dates.first || 'first'} - #{dates.last || 'last'}"
|
22
|
-
GridCLI.storage.search(type, query, dates[0], dates[1], output_format)
|
25
|
+
GridCLI.storage.search(type, query, dates[0], dates[1], output_format, @opts['from'])
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
data/lib/gridcli/storage/base.rb
CHANGED
@@ -82,18 +82,25 @@ module GridCLI
|
|
82
82
|
}
|
83
83
|
}
|
84
84
|
end
|
85
|
+
|
86
|
+
def run(pipes)
|
87
|
+
system pipes.join(" | ")
|
88
|
+
end
|
85
89
|
|
86
|
-
def search(type, query, start_date, end_date, output_format)
|
90
|
+
def search(type, query, start_date, end_date, output_format, fromuser=nil)
|
87
91
|
options = output_format.nil? ? "" : "-o #{output_format}"
|
88
92
|
files(type, start_date, end_date) { |path|
|
89
|
-
|
93
|
+
pipes = ["grep -Ri \"#{query}\" #{path}"]
|
94
|
+
pipes << "grep '\"from_username\":\"#{fromuser}\"'" unless fromuser.nil?
|
95
|
+
pipes << "#{$0} pprint #{options}"
|
96
|
+
run pipes
|
90
97
|
}
|
91
98
|
end
|
92
99
|
|
93
100
|
def list(type, start_date, end_date, output_format)
|
94
101
|
options = output_format.nil? ? "" : "-o #{output_format}"
|
95
102
|
files(type, start_date, end_date) { |path|
|
96
|
-
|
103
|
+
run ["cat #{path}", "#{$0} pprint #{options}"]
|
97
104
|
}
|
98
105
|
end
|
99
106
|
|
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: 13
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 9
|
10
|
+
version: 0.0.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Muller
|