clint 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/clint.rb +10 -6
- metadata +4 -4
data/lib/clint.rb
CHANGED
@@ -68,16 +68,21 @@ class Clint
|
|
68
68
|
while args.length > i do
|
69
69
|
|
70
70
|
# Skip anything not structured like an option.
|
71
|
-
case args[i]
|
72
|
-
when /^-([^-=\s])$/
|
71
|
+
option, value = case args[i]
|
72
|
+
when /^-([^-=\s]+)$/
|
73
|
+
args.delete_at i
|
74
|
+
$1.reverse.each_char { |c| args.insert i, "-#{c}" }
|
75
|
+
[$1[0, 1].to_sym, nil]
|
73
76
|
when /^-([^-=\s])\s*(.+)$/
|
77
|
+
[$1.to_sym, $2]
|
74
78
|
when /^--([^=\s]+)$/
|
79
|
+
[$1.to_sym, nil]
|
75
80
|
when /^--([^=\s]+)(?:=|\s+)(.+)?$/
|
81
|
+
[$1.to_sym, $2]
|
76
82
|
else
|
77
83
|
i += 1
|
78
84
|
next
|
79
85
|
end
|
80
|
-
option, value = $1.to_sym, $2
|
81
86
|
|
82
87
|
# Follow aliases through to a real option.
|
83
88
|
option = @aliases[option] while @aliases[option]
|
@@ -134,9 +139,8 @@ class Clint
|
|
134
139
|
dispatch callable.new
|
135
140
|
exit 0
|
136
141
|
end
|
137
|
-
rescue
|
138
|
-
|
139
|
-
rescue Exception
|
142
|
+
rescue Exception => e
|
143
|
+
raise e if SystemExit == e.class || SignalException == e.class
|
140
144
|
usage
|
141
145
|
exit 1
|
142
146
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 7
|
10
|
+
version: 0.2.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Richard Crowley
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-06-26 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|