cl 1.2.4 → 1.3.0
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 +5 -5
- data/Gemfile.lock +92 -22
- data/README.md +0 -30
- data/cl.gemspec +1 -1
- data/lib/cl/errors.rb +1 -1
- data/lib/cl/opts.rb +0 -7
- data/lib/cl/version.rb +1 -1
- data/lib/cl.rb +1 -10
- metadata +5 -12
- data/examples/_src/readme/secret.erb.rb +0 -22
- data/examples/readme/secret +0 -21
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6d5e927a1f14a401a69fec89a444ea48c169e36b54cce3e6149a385f81b329af
|
|
4
|
+
data.tar.gz: 33d1c497dd0bf5109522dad33ddad4fb7fd2900d39dabfed85f19940abc8a139
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 22fbd84366b91a6536bc5a0892458531f0cf9b5b96dec7c6c5a4d967db05f0b335d22ecd5c5b1c0639173613306d105cc86583ce9ff52a1c583232d59d6bc96e
|
|
7
|
+
data.tar.gz: fca8dad2c7618fe08f07efc67137b0204017fe90a2950ab26389b568c4129fe0292881ca24c33c931577bc8ecf5ae92844c38bed140b08caae7a96145ebb344c
|
data/Gemfile.lock
CHANGED
|
@@ -1,47 +1,82 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
cl (1.2.
|
|
5
|
-
regstry (~> 1.0
|
|
4
|
+
cl (1.2.4)
|
|
5
|
+
regstry (~> 1.0)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
+
bigdecimal (4.1.2)
|
|
10
11
|
coveralls (0.8.23)
|
|
11
12
|
json (>= 1.8, < 3)
|
|
12
13
|
simplecov (~> 0.16.1)
|
|
13
14
|
term-ansicolor (~> 1.3)
|
|
14
15
|
thor (>= 0.19.4, < 2.0)
|
|
15
16
|
tins (~> 1.6)
|
|
16
|
-
diff-lcs (1.
|
|
17
|
-
docile (1.
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
diff-lcs (1.6.2)
|
|
18
|
+
docile (1.4.1)
|
|
19
|
+
erb (6.0.6)
|
|
20
|
+
io-console (0.8.2)
|
|
21
|
+
irb (1.18.0)
|
|
22
|
+
pp (>= 0.6.0)
|
|
23
|
+
prism (>= 1.3.0)
|
|
24
|
+
rdoc (>= 4.0.0)
|
|
25
|
+
reline (>= 0.4.2)
|
|
26
|
+
json (2.21.1)
|
|
27
|
+
logger (1.7.0)
|
|
28
|
+
memfs (2.0.0)
|
|
29
|
+
mize (0.6.1)
|
|
30
|
+
pp (0.6.4)
|
|
31
|
+
prettyprint
|
|
32
|
+
prettyprint (0.2.0)
|
|
33
|
+
prism (1.9.0)
|
|
34
|
+
rbs (4.0.3)
|
|
35
|
+
logger
|
|
36
|
+
prism (>= 1.6.0)
|
|
37
|
+
tsort
|
|
38
|
+
rdoc (8.0.0)
|
|
39
|
+
erb
|
|
40
|
+
prism (>= 1.6.0)
|
|
41
|
+
rbs (>= 4.0.0)
|
|
42
|
+
tsort
|
|
43
|
+
readline (0.0.4)
|
|
44
|
+
reline
|
|
20
45
|
regstry (1.0.15)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
rspec-
|
|
25
|
-
|
|
26
|
-
rspec-
|
|
27
|
-
rspec-
|
|
46
|
+
reline (0.6.3)
|
|
47
|
+
io-console (~> 0.5)
|
|
48
|
+
rspec (3.13.2)
|
|
49
|
+
rspec-core (~> 3.13.0)
|
|
50
|
+
rspec-expectations (~> 3.13.0)
|
|
51
|
+
rspec-mocks (~> 3.13.0)
|
|
52
|
+
rspec-core (3.13.6)
|
|
53
|
+
rspec-support (~> 3.13.0)
|
|
54
|
+
rspec-expectations (3.13.5)
|
|
28
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
29
|
-
rspec-support (~> 3.
|
|
30
|
-
rspec-mocks (3.
|
|
56
|
+
rspec-support (~> 3.13.0)
|
|
57
|
+
rspec-mocks (3.13.8)
|
|
31
58
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
32
|
-
rspec-support (~> 3.
|
|
33
|
-
rspec-support (3.
|
|
59
|
+
rspec-support (~> 3.13.0)
|
|
60
|
+
rspec-support (3.13.7)
|
|
34
61
|
simplecov (0.16.1)
|
|
35
62
|
docile (~> 1.1)
|
|
36
63
|
json (>= 1.8, < 3)
|
|
37
64
|
simplecov-html (~> 0.10.0)
|
|
38
65
|
simplecov-html (0.10.2)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
66
|
+
sync (0.5.0)
|
|
67
|
+
term-ansicolor (1.11.3)
|
|
68
|
+
tins (~> 1)
|
|
69
|
+
thor (1.5.0)
|
|
70
|
+
tins (1.56.0)
|
|
71
|
+
bigdecimal
|
|
72
|
+
irb
|
|
73
|
+
mize (~> 0.6)
|
|
74
|
+
readline
|
|
75
|
+
sync
|
|
76
|
+
tsort (0.2.0)
|
|
43
77
|
|
|
44
78
|
PLATFORMS
|
|
79
|
+
arm64-darwin-23
|
|
45
80
|
ruby
|
|
46
81
|
|
|
47
82
|
DEPENDENCIES
|
|
@@ -50,5 +85,40 @@ DEPENDENCIES
|
|
|
50
85
|
memfs
|
|
51
86
|
rspec
|
|
52
87
|
|
|
88
|
+
CHECKSUMS
|
|
89
|
+
bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
|
|
90
|
+
bundler (4.0.16) sha256=d6ca5dd440c24f9abce9844cf44cc8e18c6a553de65a47efb4544137af92c47d
|
|
91
|
+
cl (1.2.4)
|
|
92
|
+
coveralls (0.8.23) sha256=ac63872cc7ace7274f26f29caf4edabba6eb0bb3970627d83a1e76478b7564d7
|
|
93
|
+
diff-lcs (1.6.2) sha256=9ae0d2cba7d4df3075fe8cd8602a8604993efc0dfa934cff568969efb1909962
|
|
94
|
+
docile (1.4.1) sha256=96159be799bfa73cdb721b840e9802126e4e03dfc26863db73647204c727f21e
|
|
95
|
+
erb (6.0.6) sha256=a9b24986700f5bf127c4f297c5403c3ca41b83b0a316c0cd09a096b56e644ae5
|
|
96
|
+
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
|
|
97
|
+
irb (1.18.0) sha256=de9454a0703a54704b9811a5ef31a60c86949fbf4013fcf244fabc7c775248e3
|
|
98
|
+
json (2.21.1) sha256=13a43df75d95641443f5702dff350f237164a9d811ff0f2c2800d4d980220583
|
|
99
|
+
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
100
|
+
memfs (2.0.0) sha256=7cb5ad838099d14472a25db2779ce852a358b399fd33fc48b95f5882c4e9d81f
|
|
101
|
+
mize (0.6.1) sha256=4031558979ff5426fda24c75a149b4e4c0faf4cacf2fae8938f83866ab94b780
|
|
102
|
+
pp (0.6.4) sha256=dfcb0fce700c41456265922884f9fe195d7fbb0674a3578e6c0f69588e82b570
|
|
103
|
+
prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193
|
|
104
|
+
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
|
|
105
|
+
rbs (4.0.3) sha256=5a7bf70e2628549d9a1f44eae447b2cfe55968a9c60cfff52693a4bdcc020e14
|
|
106
|
+
rdoc (8.0.0) sha256=03bf8c08a9639658855a0cfd77c0abca8325c227693f7f33f82957811348c469
|
|
107
|
+
readline (0.0.4) sha256=6138eef17be2b98298b672c3ea63bf9cb5158d401324f26e1e84f235879c1d6a
|
|
108
|
+
regstry (1.0.15) sha256=77fc9fdc2d5c33bfc21f23f1ba782d1dbb354f7058aa366aa8c6e2ed0c940ec6
|
|
109
|
+
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
|
|
110
|
+
rspec (3.13.2) sha256=206284a08ad798e61f86d7ca3e376718d52c0bc944626b2349266f239f820587
|
|
111
|
+
rspec-core (3.13.6) sha256=a8823c6411667b60a8bca135364351dda34cd55e44ff94c4be4633b37d828b2d
|
|
112
|
+
rspec-expectations (3.13.5) sha256=33a4d3a1d95060aea4c94e9f237030a8f9eae5615e9bd85718fe3a09e4b58836
|
|
113
|
+
rspec-mocks (3.13.8) sha256=086ad3d3d17533f4237643de0b5c42f04b66348c28bf6b9c2d3f4a3b01af1d47
|
|
114
|
+
rspec-support (3.13.7) sha256=0640e5570872aafefd79867901deeeeb40b0c9875a36b983d85f54fb7381c47c
|
|
115
|
+
simplecov (0.16.1) sha256=8724f0911bbb2b7a3c11155e6d57987cad311f9e5ce7b305b1e2e67fdc73dee9
|
|
116
|
+
simplecov-html (0.10.2) sha256=f65306e2695913c007ddc8d31d6318f37ae074f2ee1cea1647b3bf4c94ca30d2
|
|
117
|
+
sync (0.5.0) sha256=668356cc07c59ac7ed9ecf34fec3929831f179c07adb1f3e1c3b7a1609a638fd
|
|
118
|
+
term-ansicolor (1.11.3) sha256=8c01ec3abd095eb94dca8aed5a127d36e594239eb525eb306259c9e930534603
|
|
119
|
+
thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
|
|
120
|
+
tins (1.56.0) sha256=5ae6cf81cab8fd4b63abd2ade4eaf75543e6973c664276d949ec7027e029b46e
|
|
121
|
+
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
|
|
122
|
+
|
|
53
123
|
BUNDLED WITH
|
|
54
|
-
|
|
124
|
+
4.0.16
|
data/README.md
CHANGED
|
@@ -967,36 +967,6 @@ Cl.new('owners').run(%w(add --help))
|
|
|
967
967
|
|
|
968
968
|
```
|
|
969
969
|
|
|
970
|
-
#### Secret
|
|
971
|
-
|
|
972
|
-
Options can be declared as secret.
|
|
973
|
-
|
|
974
|
-
This makes it possible for client code to inspect if a given option is secret.
|
|
975
|
-
Also, option values given by the user will be tainted, so client code can rely
|
|
976
|
-
on this in order to, for example, obfuscate values from log output.
|
|
977
|
-
|
|
978
|
-
```ruby
|
|
979
|
-
class Add < Cl::Cmd
|
|
980
|
-
register :add
|
|
981
|
-
|
|
982
|
-
opt '--pass PASS', secret: true
|
|
983
|
-
|
|
984
|
-
def run
|
|
985
|
-
p(
|
|
986
|
-
secret?: self.class.opts[:pass].secret?,
|
|
987
|
-
tainted?: pass.tainted?
|
|
988
|
-
)
|
|
989
|
-
end
|
|
990
|
-
end
|
|
991
|
-
|
|
992
|
-
Cl.new('owners').run(%w(add --pass pass))
|
|
993
|
-
|
|
994
|
-
# Output:
|
|
995
|
-
#
|
|
996
|
-
# {:secret?=>true, :tainted?=>true}
|
|
997
|
-
|
|
998
|
-
```
|
|
999
|
-
|
|
1000
970
|
#### See Also
|
|
1001
971
|
|
|
1002
972
|
Options can refer to documentation using the `see` option. This will be printed
|
data/cl.gemspec
CHANGED
data/lib/cl/errors.rb
CHANGED
data/lib/cl/opts.rb
CHANGED
|
@@ -22,7 +22,6 @@ class Cl
|
|
|
22
22
|
opts = downcase(opts)
|
|
23
23
|
opts = upcase(opts)
|
|
24
24
|
opts = cast(opts)
|
|
25
|
-
opts = taint(opts)
|
|
26
25
|
validate(cmd, self, opts, orig)
|
|
27
26
|
opts
|
|
28
27
|
end
|
|
@@ -106,11 +105,5 @@ class Cl
|
|
|
106
105
|
[key, self[key] ? self[key].cast(value) : value]
|
|
107
106
|
end.to_h
|
|
108
107
|
end
|
|
109
|
-
|
|
110
|
-
def taint(opts)
|
|
111
|
-
opts.map do |key, value|
|
|
112
|
-
[key, self[key] && self[key].secret? ? value.taint : value]
|
|
113
|
-
end.to_h
|
|
114
|
-
end
|
|
115
108
|
end
|
|
116
109
|
end
|
data/lib/cl/version.rb
CHANGED
data/lib/cl.rb
CHANGED
|
@@ -31,7 +31,7 @@ class Cl
|
|
|
31
31
|
#
|
|
32
32
|
# @param args [Array<String>] arguments (usually ARGV)
|
|
33
33
|
def run(args)
|
|
34
|
-
runner(
|
|
34
|
+
runner(args).run
|
|
35
35
|
rescue UnknownCmd => e
|
|
36
36
|
ctx.abort e
|
|
37
37
|
rescue Error => e
|
|
@@ -50,13 +50,4 @@ class Cl
|
|
|
50
50
|
runner(['help', *args]).cmd.help
|
|
51
51
|
rescue
|
|
52
52
|
end
|
|
53
|
-
|
|
54
|
-
private
|
|
55
|
-
|
|
56
|
-
# Tainting is being used for identifying values on options that have
|
|
57
|
-
# been declared as secret. Ruby taints incoming arguments, so we want to
|
|
58
|
-
# untaint them here.
|
|
59
|
-
def untaint(args)
|
|
60
|
-
args.map(&:dup).each(&:untaint)
|
|
61
|
-
end
|
|
62
53
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cl
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sven Fuchs
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: regstry
|
|
@@ -16,14 +15,14 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - "~>"
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 1.0
|
|
18
|
+
version: '1.0'
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - "~>"
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 1.0
|
|
25
|
+
version: '1.0'
|
|
27
26
|
description: |-
|
|
28
27
|
OptionParser based CLI support for rapid CLI development in an object-oriented
|
|
29
28
|
context.
|
|
@@ -34,7 +33,6 @@ description: |-
|
|
|
34
33
|
On top of that it adds a rich and powerful DSL for defining, validating, and
|
|
35
34
|
normalizing options, as well as automatic and gorgeous help output (modeled
|
|
36
35
|
after `gem --help`).
|
|
37
|
-
email:
|
|
38
36
|
executables: []
|
|
39
37
|
extensions: []
|
|
40
38
|
extra_rdoc_files: []
|
|
@@ -82,7 +80,6 @@ files:
|
|
|
82
80
|
- examples/_src/readme/requires.erb.rb
|
|
83
81
|
- examples/_src/readme/runner.erb.rb
|
|
84
82
|
- examples/_src/readme/runner_custom.erb.rb
|
|
85
|
-
- examples/_src/readme/secret.erb.rb
|
|
86
83
|
- examples/_src/readme/see.erb.rb
|
|
87
84
|
- examples/_src/readme/type.erb.rb
|
|
88
85
|
- examples/args/cast
|
|
@@ -120,7 +117,6 @@ files:
|
|
|
120
117
|
- examples/readme/requires
|
|
121
118
|
- examples/readme/runner
|
|
122
119
|
- examples/readme/runner_custom
|
|
123
|
-
- examples/readme/secret
|
|
124
120
|
- examples/readme/see
|
|
125
121
|
- examples/readme/type
|
|
126
122
|
- lib/cl.rb
|
|
@@ -156,7 +152,6 @@ homepage: https://github.com/svenfuchs/cl
|
|
|
156
152
|
licenses:
|
|
157
153
|
- MIT
|
|
158
154
|
metadata: {}
|
|
159
|
-
post_install_message:
|
|
160
155
|
rdoc_options: []
|
|
161
156
|
require_paths:
|
|
162
157
|
- lib
|
|
@@ -171,9 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
171
166
|
- !ruby/object:Gem::Version
|
|
172
167
|
version: '0'
|
|
173
168
|
requirements: []
|
|
174
|
-
|
|
175
|
-
rubygems_version: 2.6.11
|
|
176
|
-
signing_key:
|
|
169
|
+
rubygems_version: 4.0.20
|
|
177
170
|
specification_version: 4
|
|
178
171
|
summary: Object-oriented OptionParser based CLI support
|
|
179
172
|
test_files: []
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
$: << File.expand_path('lib')
|
|
3
|
-
|
|
4
|
-
<%= run sq(<<-'rb')
|
|
5
|
-
class Add < Cl::Cmd
|
|
6
|
-
register :add
|
|
7
|
-
|
|
8
|
-
opt '--pass PASS', secret: true
|
|
9
|
-
|
|
10
|
-
def run
|
|
11
|
-
p(
|
|
12
|
-
secret?: self.class.opts[:pass].secret?,
|
|
13
|
-
tainted?: pass.tainted?
|
|
14
|
-
)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
rb
|
|
18
|
-
-%>
|
|
19
|
-
|
|
20
|
-
<%= run "Cl.new('owners').run(%w(add --pass pass))" %>
|
|
21
|
-
|
|
22
|
-
<%= out '{:secret?=>true, :tainted?=>true}' %>
|
data/examples/readme/secret
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
$: << File.expand_path('lib')
|
|
3
|
-
|
|
4
|
-
class Add < Cl::Cmd
|
|
5
|
-
register :add
|
|
6
|
-
|
|
7
|
-
opt '--pass PASS', secret: true
|
|
8
|
-
|
|
9
|
-
def run
|
|
10
|
-
p(
|
|
11
|
-
secret?: self.class.opts[:pass].secret?,
|
|
12
|
-
tainted?: pass.tainted?
|
|
13
|
-
)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
Cl.new('owners').run(%w(add --pass pass))
|
|
18
|
-
|
|
19
|
-
# Output:
|
|
20
|
-
#
|
|
21
|
-
# {:secret?=>true, :tainted?=>true}
|