fuelcell 0.2.1 → 0.2.2
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 +8 -8
- data/bin/test +3 -4
- data/lib/fuelcell/action/opts_manager.rb +4 -0
- data/lib/fuelcell/parser/arg_handler.rb +13 -2
- data/lib/fuelcell/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OTg3NDk4Y2I4ZWI1YzEwOWI0NzYxODY1Y2JlZGUwYzAzNDhmMWQxZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDY3MzdiNjdmM2RmYTMyNzk5MjMxZWU3MTk0ZjlhMTQ5YTdmYmJjZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODJhODQxYTcwYjg1ZmVmZDA5OGI5ZDc2M2QyNWE2ZWM3YjE2MGMwMDkxNDUx
|
10
|
+
ZDBiNjdkNmE5OTMxYzVjZjY0ZGI4OGU3MTM1YjE0NTA2NWMwOWNhODA2Y2Rh
|
11
|
+
M2VlNjljZTU2YzgxOWJlZjEzNWQwNmY4ZGUyNDUxMWY2MTdiMjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MWMwZDk4ZDg5YzQ1MmE2MDRiNmFjNDdjYzBhYTYxNmU4MmI3N2NhNDI3NWI3
|
14
|
+
NGFkY2RkNjkwYTQyMDczMjg0ZWMzNTZmODFmNTBlM2IxNGRmOTEzYzc4NmFi
|
15
|
+
OWM4ZmM1MDhhZDNmNDE2YzlhYzVhMGQzMDRlZmRiMmQ2NjExYjE=
|
data/bin/test
CHANGED
@@ -7,17 +7,16 @@ require "fuelcell"
|
|
7
7
|
Fuelcell.start(ARGV.dup, backtrace: true) do
|
8
8
|
require_relative 'example'
|
9
9
|
desc 'this is an example of how a commands work with fuelcell'
|
10
|
-
opt '
|
10
|
+
opt 'version|v', banner: 'version of app', cmd_path: 'version', global: true
|
11
11
|
arg 'foo', required: true
|
12
12
|
|
13
13
|
run ->(opts, args, shell) {
|
14
14
|
shell.puts "testing #{args.foo}"
|
15
15
|
}
|
16
|
-
command '
|
17
|
-
opt 'blah'
|
16
|
+
command 'version' do
|
18
17
|
desc 'the fiz command'
|
19
18
|
run -> (opts, args, shell) {
|
20
|
-
shell.puts "
|
19
|
+
shell.puts "0.1.0"
|
21
20
|
}
|
22
21
|
end
|
23
22
|
end
|
@@ -14,6 +14,10 @@ module Fuelcell
|
|
14
14
|
options.each {|_, option| yield option }
|
15
15
|
end
|
16
16
|
|
17
|
+
def callable?
|
18
|
+
!callable.nil?
|
19
|
+
end
|
20
|
+
|
17
21
|
# Check to determine if any of the options are callable, meaning do
|
18
22
|
# they point to another command or have a lambda to be executed
|
19
23
|
#
|
@@ -12,8 +12,12 @@ module Fuelcell
|
|
12
12
|
# @return [Fuelcell::Action::ArgsResults]
|
13
13
|
def call(cmd, args)
|
14
14
|
list = {}
|
15
|
-
|
16
|
-
|
15
|
+
args_manager = cmd.args
|
16
|
+
opts_manager = cmd.opts
|
17
|
+
|
18
|
+
return create_results(args, list) if opts_manager.callable?
|
19
|
+
|
20
|
+
args_manager.each_with_index do |arg, index|
|
17
21
|
value = args.fetch(index) {
|
18
22
|
fail "argument at #{index} is required" if arg.required?
|
19
23
|
arg.default? ? arg.default : SKIP
|
@@ -24,8 +28,15 @@ module Fuelcell
|
|
24
28
|
list[arg.name] = index
|
25
29
|
end
|
26
30
|
|
31
|
+
create_results(args, list)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def create_results(args, list)
|
27
37
|
Fuelcell::Action::ArgResults.new(args, list)
|
28
38
|
end
|
39
|
+
|
29
40
|
end
|
30
41
|
end
|
31
42
|
end
|
data/lib/fuelcell/version.rb
CHANGED