yac 1.1.4 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/README.rdoc +21 -21
- data/Rakefile +1 -1
- data/lib/yac.rb +12 -13
- data/yac.gemspec +1 -1
- metadata +1 -1
data/CHANGELOG
CHANGED
data/README.rdoc
CHANGED
@@ -19,50 +19,50 @@
|
|
19
19
|
=== To show a cheat sheet:
|
20
20
|
$ yac (show) [cheatsheet] ( you can use * for any chars)
|
21
21
|
Eg:
|
22
|
-
$ yac
|
23
|
-
$ yac
|
22
|
+
$ yac lin*x
|
23
|
+
$ yac l/o/a To show linux/gentoo/masked
|
24
24
|
|
25
25
|
=== To edit a cheat sheet
|
26
|
-
$ yac
|
26
|
+
$ yac -e [cheatsheet] (Yes,you can use * for any chars also,then choose one to edit)
|
27
27
|
|
28
28
|
=== To add a cheat sheet
|
29
|
-
$ yac
|
29
|
+
$ yac -a [cheatsheet] (OMG,you can also use *)
|
30
30
|
Eg:
|
31
|
-
$ yac li*x/install
|
31
|
+
$ yac -a li*x/install
|
32
32
|
Then will display all directories match /li*x/,feel freely to choose one of them,
|
33
33
|
A new file named install.ch will be added to the directory!
|
34
|
-
$ yac l/oo/install
|
34
|
+
$ yac -a l/oo/install
|
35
35
|
Oh,no,you can choose linux/gentoo as the directory for the install file
|
36
36
|
|
37
37
|
=== To rm a cheat sheet
|
38
|
-
$ yac
|
38
|
+
$ yac -r [cheatsheet] (Sure,you can use *)
|
39
39
|
|
40
40
|
=== Search all sheets
|
41
|
-
$ yac
|
41
|
+
$ yac -S [keyword] (@@@Take Attention:@@@ You are allowed to use perl-like Regex)
|
42
42
|
Eg:
|
43
|
-
$ yac
|
43
|
+
$ yac -S lin.*x
|
44
44
|
And Even:
|
45
|
-
$ yac
|
45
|
+
$ yac -S "r(uby|ails)"
|
46
46
|
|
47
47
|
=== Update repositories
|
48
|
-
$ yac
|
49
|
-
$ yac
|
50
|
-
$ yac
|
48
|
+
$ yac -u main => Update main repository
|
49
|
+
$ yac -u all => Update all repositories
|
50
|
+
$ yac -u => Update private repository
|
51
51
|
|
52
52
|
=== Shell
|
53
|
-
$ yac
|
54
|
-
$ yac
|
53
|
+
$ yac -s main => Open the main repository's shell
|
54
|
+
$ yac -s => Open the private repository's shell
|
55
55
|
|
56
56
|
== Repository Push
|
57
|
-
$ yac
|
58
|
-
$ yac
|
59
|
-
$ yac
|
57
|
+
$ yac -p main => Push the main repository
|
58
|
+
$ yac -p all => Push all repositories
|
59
|
+
$ yac -p => Push the private repository
|
60
60
|
|
61
|
-
== Rename a cheatsheet:
|
62
|
-
$ yac
|
61
|
+
== Rename/mv a cheatsheet:
|
62
|
+
$ yac -m [orign_name] [new_name]
|
63
63
|
|
64
64
|
=== Help (display this file)
|
65
|
-
$ yac
|
65
|
+
$ yac -h
|
66
66
|
|
67
67
|
=== Documents format
|
68
68
|
All text file add ".ch" as suffix for butter editor highlight
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('yac', '1.
|
5
|
+
Echoe.new('yac', '1.2.0') do |p|
|
6
6
|
p.description = "Yet Another Cheat: sexy command line tool for cheat sheet."
|
7
7
|
p.url = "http://www.zhangjinzhu.com"
|
8
8
|
p.author = "Jinzhu Zhang"
|
data/lib/yac.rb
CHANGED
@@ -20,20 +20,19 @@ module Yac
|
|
20
20
|
init unless File.exist?(@main_path) && File.exist?(@pri_path)
|
21
21
|
(help && exit) if args.empty?
|
22
22
|
case args.first
|
23
|
-
when "
|
24
|
-
when "
|
25
|
-
when "
|
26
|
-
when "
|
27
|
-
when "
|
28
|
-
when "
|
29
|
-
when "edit" then edit(args[1,args.size])
|
23
|
+
when "-S" then search(args[1,args.size])
|
24
|
+
when "-u" then update(args[1,args.size])
|
25
|
+
when "-p" then push(args[1,args.size])
|
26
|
+
when "-l" then log(args[1,args.size])
|
27
|
+
when "-a" then add(args[1,args.size])
|
28
|
+
when "-e" then edit(args[1,args.size])
|
30
29
|
when /^(help|-h|yac|--help)$/ then help
|
31
|
-
when "
|
32
|
-
when "
|
33
|
-
when "
|
30
|
+
when "-s" then shell(args[1,args.size])
|
31
|
+
when "-r" then rm(args[1,args.size])
|
32
|
+
when "-m" then mv(args[1,args.size])
|
34
33
|
else show(args)
|
35
34
|
end
|
36
|
-
|
35
|
+
rescue
|
37
36
|
end
|
38
37
|
|
39
38
|
def init
|
@@ -118,7 +117,7 @@ module Yac
|
|
118
117
|
end
|
119
118
|
end
|
120
119
|
|
121
|
-
def
|
120
|
+
def mv(args)
|
122
121
|
(colorful("Usage:\nyac mv [orign_name] [new_name]\n\nTry `yac -h` for more help","warn");exit) unless args.size == 2
|
123
122
|
file = search_name(args[0],"Rename")
|
124
123
|
#You can use $ yac mv linux.ch linux/ to rename linux.ch to linux/linux.ch
|
@@ -219,7 +218,7 @@ module Yac
|
|
219
218
|
return file.strip
|
220
219
|
end
|
221
220
|
|
222
|
-
def confirm(*msg)
|
221
|
+
def confirm(*msg)
|
223
222
|
colorful("#{msg.to_s}\nAre You Sure (Y/N) (q to quit):","notice",false)
|
224
223
|
return STDIN.gets.to_s =~ /n|q/i ? false : true
|
225
224
|
end
|
data/yac.gemspec
CHANGED