gridcli 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +14 -0
- data/lib/gridcli/config.rb +0 -1
- data/lib/gridcli/runner.rb +23 -0
- data/lib/gridcli/storage/files.rb +9 -7
- data/lib/gridcli/version.rb +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -35,6 +35,8 @@ To list the friends of a friend:
|
|
35
35
|
To send a message to a list of users:
|
36
36
|
grid message <username>[,<username>,...] [-s <subject>] [-b <body>] [-f <body file>]
|
37
37
|
|
38
|
+
If you don't give a -b/-f option, an editor will open allowing you to type your message.
|
39
|
+
|
38
40
|
To send a status update, like, or dislike to your friends:
|
39
41
|
grid status <status message>
|
40
42
|
grid like <like message>
|
@@ -90,6 +92,18 @@ You can then use the group as though it were a user. For instance, to send a me
|
|
90
92
|
|
91
93
|
If you prefer to simply edit the config file, you can do so (the file is located at ~/.grid/subgrids).
|
92
94
|
|
95
|
+
== Aliases
|
96
|
+
It's possible to create command aliases much like aliases in .gitconfig. For instance, if you add a section to your ~/.grid/config file:
|
97
|
+
...
|
98
|
+
alias:
|
99
|
+
recent: list all "yesterday to now"
|
100
|
+
|
101
|
+
Then you can now run:
|
102
|
+
grid recent
|
103
|
+
|
104
|
+
Which is the equivalent of running:
|
105
|
+
grid list all "yesterday to now"
|
106
|
+
|
93
107
|
== Plugins
|
94
108
|
Plugins are easy to create and can register hooks. To install/uninstall a plugin, use:
|
95
109
|
grid plugin install <name>
|
data/lib/gridcli/config.rb
CHANGED
data/lib/gridcli/runner.rb
CHANGED
@@ -4,6 +4,13 @@ module GridCLI
|
|
4
4
|
class Runner
|
5
5
|
def self.run(args)
|
6
6
|
cmd = args.shift
|
7
|
+
|
8
|
+
aliases = GridCLI.config['alias']
|
9
|
+
if aliases.has_key?(cmd)
|
10
|
+
args = self.shellsplit(aliases[cmd]) + args
|
11
|
+
cmd = args.shift
|
12
|
+
end
|
13
|
+
|
7
14
|
cmd = "help" if not @@cmds.has_key? cmd
|
8
15
|
begin
|
9
16
|
@@cmds[cmd].new.run(args)
|
@@ -24,5 +31,21 @@ module GridCLI
|
|
24
31
|
def self.commands
|
25
32
|
@@cmds.values
|
26
33
|
end
|
34
|
+
|
35
|
+
# taken from http://svn.ruby-lang.org/repos/ruby/trunk/lib/shellwords.rb
|
36
|
+
def self.shellsplit(line)
|
37
|
+
words = []
|
38
|
+
field = ''
|
39
|
+
line.scan(/\G\s*(?>([^\s\\\'\"]+)|'([^\']*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|\z)?/m) do
|
40
|
+
|word, sq, dq, esc, garbage, sep|
|
41
|
+
raise ArgumentError, "Unmatched double quote: #{line.inspect}" if garbage
|
42
|
+
field << (word || sq || (dq || esc).gsub(/\\(.)/, '\\1'))
|
43
|
+
if sep
|
44
|
+
words << field
|
45
|
+
field = ''
|
46
|
+
end
|
47
|
+
end
|
48
|
+
words
|
49
|
+
end
|
27
50
|
end
|
28
51
|
end
|
@@ -42,29 +42,31 @@ module GridCLI
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def years(type)
|
45
|
-
Dir.glob(File.join(@basedir, type, '*')).map { |f| File.basename(f) }
|
45
|
+
Dir.glob(File.join(@basedir, type, '*')).map { |f| File.basename(f).to_i }
|
46
46
|
end
|
47
47
|
|
48
48
|
def months(type, year)
|
49
|
-
Dir.glob(File.join(@basedir, type, year, '*')).map { |f| File.basename(f) }
|
49
|
+
Dir.glob(File.join(@basedir, type, year.to_s, '*')).map { |f| File.basename(f).to_i }
|
50
50
|
end
|
51
51
|
|
52
52
|
def dates(type, year, month)
|
53
|
-
Dir.glob(File.join(@basedir, type, year, month, '*')).map { |f|
|
53
|
+
Dir.glob(File.join(@basedir, type, year.to_s, month.to_s, '*')).map { |f|
|
54
|
+
File.basename(f).split('.').first.to_i
|
55
|
+
}
|
54
56
|
end
|
55
57
|
|
56
58
|
def min_date(type)
|
57
59
|
year = years(type).sort.first
|
58
60
|
month = months(type, year).sort.first
|
59
|
-
date = dates(type, year, month).sort.first
|
60
|
-
Date.new year
|
61
|
+
date = dates(type, year, month).sort.first
|
62
|
+
Date.new year, month, date
|
61
63
|
end
|
62
64
|
|
63
65
|
def max_date(type)
|
64
66
|
year = years(type).sort.last
|
65
67
|
month = months(type, year).sort.last
|
66
|
-
date = dates(type, year, month).sort.last
|
67
|
-
Date.new year
|
68
|
+
date = dates(type, year, month).sort.last
|
69
|
+
Date.new year, month, date
|
68
70
|
end
|
69
71
|
|
70
72
|
def has_type?(type)
|
data/lib/gridcli/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: gridcli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Brian Muller
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-10-
|
13
|
+
date: 2012-10-12 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activeresource
|