dictuby 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dictuby/args_parser.rb +34 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd1cce07d7fb71af851b8cf4d063dd214d968e1c
|
4
|
+
data.tar.gz: 8355d4cc06e64a257b43930050d43c031202cbaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 108ab70f1ea2b4f0795429e66d00adb9857357fd20c4a3b4264313ce85bce47692d3b50146932f787edf276b222ecee1432bc6b6032c6efe7c555f2608993dcc
|
7
|
+
data.tar.gz: 6900dc9ed4ca10d4e1dece4ffbd6832c3e06beb539b621bb9eecffe1203e95b57a4f940a7a2eb8f4771d14bdb1c65e7ba6676a2353cead5d9def4a71e2825d0f
|
data/lib/dictuby/args_parser.rb
CHANGED
@@ -4,12 +4,41 @@ module Dictuby
|
|
4
4
|
def self.parse(args)
|
5
5
|
options = {}
|
6
6
|
|
7
|
+
args << '--help' if args.empty?
|
8
|
+
|
7
9
|
OptionParser.new do |o|
|
8
|
-
o.on(
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
o.on(
|
11
|
+
'-h',
|
12
|
+
'--help',
|
13
|
+
'Display this message'
|
14
|
+
) do
|
15
|
+
puts o; exit
|
16
|
+
end
|
17
|
+
|
18
|
+
o.on(
|
19
|
+
'-l',
|
20
|
+
'--list-dicts',
|
21
|
+
'List available dictionaries'
|
22
|
+
) do |b|
|
23
|
+
options[:list] = b
|
24
|
+
end
|
25
|
+
|
26
|
+
o.on(
|
27
|
+
'-g',
|
28
|
+
'--get-dict',
|
29
|
+
'Display current active dictionary'
|
30
|
+
) do |b|
|
31
|
+
options[:get] = b
|
32
|
+
end
|
33
|
+
|
34
|
+
o.on(
|
35
|
+
'-s DICTIONARY',
|
36
|
+
'--set-dict DICTIONARY',
|
37
|
+
'Set active dictionary'
|
38
|
+
) do |d|
|
39
|
+
options[:set] = d
|
40
|
+
end
|
41
|
+
o.on('QUERY') {}
|
13
42
|
o.parse!
|
14
43
|
end
|
15
44
|
|