appl 1.17 → 1.18
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.
- checksums.yaml +4 -4
- data/lib/appl.rb +13 -6
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 910d3c31e9ccea4a482121b2a580b2a764d18603057f4f55ded3de0da4f6570f
|
4
|
+
data.tar.gz: 1266cccb0ea094c1d560947456006064f6eb4f26561b706f9aeff18c47e23119
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 43612b15a512ec95b6b8915d72e85d3673417f21b164d08767d4d2bb33210c633b8b24c90c0e6b7b711ee96fad27f07715b6bb636846f6d605269d329417099e
|
7
|
+
data.tar.gz: 628aa7d1fb71c47c4be0403b921ba3461eae58f231a057cc70acf3b1aefab94b82e9a00375958d46b7207d13d2059bc1e08d0799d3e37a3d5a342b2c4d232ab7
|
data/lib/appl.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
class Application
|
7
7
|
|
8
|
-
APPL_VERSION = "1.
|
8
|
+
APPL_VERSION = "1.18".freeze
|
9
9
|
|
10
10
|
OPTIONS_ENV = nil
|
11
11
|
|
@@ -25,7 +25,13 @@ class Application
|
|
25
25
|
@name, @args = name, args
|
26
26
|
self.class.each_option { |opt,desc,arg,dfl,act|
|
27
27
|
begin
|
28
|
-
|
28
|
+
if dfl then
|
29
|
+
if arg then
|
30
|
+
send act, dfl
|
31
|
+
else
|
32
|
+
send act
|
33
|
+
end
|
34
|
+
end
|
29
35
|
rescue NoMethodError
|
30
36
|
raise OptionError, "Option action `#{act}' is not defined."
|
31
37
|
end
|
@@ -133,7 +139,9 @@ class Application
|
|
133
139
|
desc = param.pop
|
134
140
|
arg = param.shift
|
135
141
|
if arg then
|
136
|
-
if
|
142
|
+
if arg == true then
|
143
|
+
arg, dfl = nil, true
|
144
|
+
elsif param.empty? then
|
137
145
|
arg, dfl = arg.split /:/, 2
|
138
146
|
if dfl =~ /\A:/ then
|
139
147
|
dfl = $'.to_sym
|
@@ -212,9 +220,8 @@ class Application
|
|
212
220
|
def show_options
|
213
221
|
options_desc do |opt,arg,dfl,desc|
|
214
222
|
opt = opt.length == 1 ? "-#{opt}" : "--#{opt}"
|
215
|
-
arg
|
216
|
-
|
217
|
-
arg << dfl if arg && dfl
|
223
|
+
arg = "#{arg}"
|
224
|
+
arg << "[#{dfl}]" if dfl
|
218
225
|
l = " %-*s %-*s %s" % [ root::W_OPTS, opt, root::W_ARGS, arg, desc]
|
219
226
|
l.rstrip!
|
220
227
|
puts l
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: appl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.18'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bertram Scharpf
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
A base class for command line applications doing options parsing
|
@@ -42,7 +42,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
42
42
|
version: '0'
|
43
43
|
requirements:
|
44
44
|
- Just Ruby
|
45
|
-
rubygems_version: 3.5.
|
45
|
+
rubygems_version: 3.5.23
|
46
46
|
signing_key:
|
47
47
|
specification_version: 4
|
48
48
|
summary: Easy option parsing
|