mcli 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 8525a628284d643fb3483ac0ecd460520968aa74
4
- data.tar.gz: 6fb3670630b6ba42e2a8c39d2b16c89677fea286
2
+ SHA256:
3
+ metadata.gz: 28be10940e26365f8220e4527b2489a569793bfed2cfd447b192cc699ea3d867
4
+ data.tar.gz: 346512463395635971fb1d121c112eb46f16c53796e8536eee9e016a404458c6
5
5
  SHA512:
6
- metadata.gz: 33d8b44f87b79c4a05f5e1e2315ecb006980d4e70391bd8149b6bd57aecf207b057283cd4c6524718f94a289b150b901d4498e869aed2b1ab6c46cade7b8d87e
7
- data.tar.gz: c1dd2a0e0062c087e8303c38ee39887a59a185572437e94d33b4e6660d9322c281511956542c65e7afe0cef59c9bfdceaa8f924e2ff1e7860851d484a40dcc06
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.
@@ -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
@@ -1,3 +1,3 @@
1
1
  module MCLI
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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: 2017-10-11 00:00:00.000000000 Z
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
- rubyforge_project:
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