mcli 0.1.0 → 0.2.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/README.md +26 -0
- data/lib/mcli/command.rb +9 -1
- data/lib/mcli/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 28be10940e26365f8220e4527b2489a569793bfed2cfd447b192cc699ea3d867
|
4
|
+
data.tar.gz: 346512463395635971fb1d121c112eb46f16c53796e8536eee9e016a404458c6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1509cc7add46967523cb0a68be0d7793b7f019c3dd9b6e173f846718da954657997315e7dffaefa319a2c8f206da186a4dc2dd7d4ebe023e20a8abda0f4871a3
|
7
|
+
data.tar.gz: 9924b09bfdb5afd6dd960f51e9dbcab4d44258a886f653a18cdcb5eaa1c90024133e400ff4014fb8e573f8f5076582e8220307dad120b9ab0b2adf16d7f4d2ee
|
data/README.md
CHANGED
@@ -191,6 +191,32 @@ $ ./options.rb options --no-heads
|
|
191
191
|
Heads: false
|
192
192
|
```
|
193
193
|
|
194
|
+
##### Capturing all arguments
|
195
|
+
|
196
|
+
```ruby
|
197
|
+
#capture.rb
|
198
|
+
```
|
199
|
+
```ruby
|
200
|
+
#!/usr/bin/env ruby
|
201
|
+
require 'mcli'
|
202
|
+
|
203
|
+
class Options < MCLI::Command
|
204
|
+
register_as :capture
|
205
|
+
capture_all!
|
206
|
+
|
207
|
+
def run
|
208
|
+
puts "#{arg.inspect}"
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
MCLI.run
|
213
|
+
```
|
214
|
+
|
215
|
+
```bash
|
216
|
+
$ ./capture.rb capture --toast=cool one two -a ok three
|
217
|
+
["--toast=cool", "one", "two", "-a", "ok", "three"]
|
218
|
+
```
|
219
|
+
|
194
220
|
## Development
|
195
221
|
|
196
222
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/mcli/command.rb
CHANGED
@@ -56,10 +56,18 @@ class MCLI::Command
|
|
56
56
|
MCLI::CommandGroup.register(command_name, self)
|
57
57
|
end
|
58
58
|
|
59
|
+
def capture_all!
|
60
|
+
@capture_all = true
|
61
|
+
end
|
62
|
+
|
63
|
+
def capture_all?
|
64
|
+
@capture_all
|
65
|
+
end
|
66
|
+
|
59
67
|
def call
|
60
68
|
new(ARGV).tap do |command|
|
61
69
|
begin
|
62
|
-
command.parse
|
70
|
+
command.parse unless capture_all?
|
63
71
|
command.run
|
64
72
|
rescue MCLI::HelpError
|
65
73
|
command.help
|
data/lib/mcli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mcli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Thomas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -97,8 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
|
101
|
-
rubygems_version: 2.6.11
|
100
|
+
rubygems_version: 3.0.6
|
102
101
|
signing_key:
|
103
102
|
specification_version: 4
|
104
103
|
summary: Create CLI tools using ruby objects with a nice API
|