fuelcell 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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NmY4YWExNmViMzhhMjBkM2Y4MWQ4YzgyYWE3OTBkNzIxMDhiNzU5Yg==
4
+ OWMyNzZhNWVlZThhNWNhZjI4ZGY2ODNiZTMwMWIwNGJmYzZkYmI3Zg==
5
5
  data.tar.gz: !binary |-
6
- ZTk4ZDFkYTJiMzc4MmUxNTU4NjQxODQ4ZjcwNTA4MDkxNTc3ZjU3MA==
6
+ NzZmMjRmYmJhMWM0NmJmNmRmYjA1MGEyYTA3YzRhMzY0NmUyZGRlNg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWQ0ZWI5MDE5OWQ1YjgxMTI4MDlkZjJiODI3MGZiZDQ4ZjlmM2ZjZmNmMTk2
10
- ZDJjNmE2NDdmMzRhM2I1MWYzODZjZDY5MjdhNjBmMWRkODI2NDRhM2I3YTM5
11
- ODI0YjBjZGExNzlkMDhhYjdkNGY4M2FlNWM2MDllNmVkYjMwNTg=
9
+ Y2JkMjBkMGMyOWU3YWE0MTU3NzI2Njk4YjJjNzQ1MGVjODk3ZTc4Y2YwZDI4
10
+ ZDc2ZjNkNDU5ZDcwZTgyOTQ4NDc0NTc2ZjFiN2M0YjFlNzM5ZDM1YjBhNGEz
11
+ YWMwYzBhOTA4ZTA5MDM5MzRmZDY3OTEzZjY4ZmU2YjdlMmQ3OGM=
12
12
  data.tar.gz: !binary |-
13
- YWMyY2EzMmYwYTM0ZjFhM2QxMjE5MDBmOGJmZDRkOTc0MmFiNTNkMTJmNjY0
14
- NzRiNGU4Y2JhZTdjMWYwZDI4MWFmYzk2MDNlMzRkNmI3MmM0MDg0NTg3Zjhh
15
- YTExODA0MzMxNzYzMDI1ZTNhYjUxZjFjMGJkMDQ0M2Y1ZjAzODU=
13
+ ODU1MmU2MDg1NTU1ZDMwNGE3NjdkMGMxYWMxY2Q3ZDhhZmNmZjg3NzVhNDNk
14
+ NGUzMDI1NzAzOTNhNWU2YmQ4NDYwZDc1NGU1M2RkZjFmZDFlMmJjOTdhZTQ3
15
+ YWIzNDQ2ZTQ1MTdhMmVkNWRlZTBjZTFjYjlhNzBmZjIwMTEzODk=
data/bin/test CHANGED
@@ -13,8 +13,8 @@ Fuelcell.start(ARGV.dup, backtrace: true) do
13
13
  shell.puts "testing #{args.foo}"
14
14
  }
15
15
  command 'fiz' do
16
- run ->(opts, args, shell) {
17
- shell.puts 'called by options'
18
- }
16
+ opt 'blah'
17
+ desc 'the fiz command'
18
+
19
19
  end
20
20
  end
data/bin/world.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  Fuelcell.define 'hello world' do
2
2
  desc 'the world is saying hello'
3
- run ->(opts, args, shell) {
4
- shell.puts 'world hello example'
5
- }
3
+ #run ->(opts, args, shell) {
4
+ # shell.puts 'world hello example'
5
+ #}
6
6
  end
data/lib/fuelcell/cli.rb CHANGED
@@ -40,7 +40,7 @@ module Fuelcell
40
40
  cmd = root.locate(cmd_args, raw_args)
41
41
  root.add_global_options(cmd)
42
42
  begin
43
- parser.call(cmd, raw_args)
43
+ parser.call(cmd, cmd_args, raw_args)
44
44
  rescue Exception => e
45
45
  shell.error e.message
46
46
  shell.failure_exit
@@ -56,10 +56,14 @@ module Fuelcell
56
56
  cmd = context[:cmd]
57
57
  opts = context[:opts] || {}
58
58
  args = context[:args] || []
59
+ cmd_args = context[:cmd_args]
59
60
  cli_shell = context[:shell] || shell
60
61
 
61
- cmd = handle_callable_option(root, cmd)
62
+ unless cmd.callable?
63
+ return root['help'].call(opts, cmd_args, shell)
64
+ end
62
65
 
66
+ cmd = handle_callable_option(root, cmd)
63
67
  cmd.call(opts, args, cli_shell)
64
68
 
65
69
  end
@@ -3,7 +3,8 @@ module Fuelcell
3
3
  class Builder
4
4
 
5
5
  def call(root, args, help = {})
6
- cmd = args.empty? ? root : root.locate(args.raw)
6
+ args = args.is_a?(Array) ? args : args.raw
7
+ cmd = args.empty? ? root : root.locate(args)
7
8
  path = args.join(' ').strip
8
9
  build_usage(root.name, path, cmd, help)
9
10
  build_options(cmd.opts, help)
@@ -41,7 +41,7 @@ module Fuelcell
41
41
  # @param raw_args [Array] raw args from ARGV
42
42
  # @param opts [Hash] stores processed options
43
43
  # @return [Array] the process options and processed args
44
- def call(cmd, raw_args, opts = Fuelcell::Action::OptResults.new)
44
+ def call(cmd, cmd_args, raw_args, opts = Fuelcell::Action::OptResults.new)
45
45
  ignores = ignore_handler.call(raw_args)
46
46
  args = run_option_handlers(cmd, raw_args, opts)
47
47
  args = arg_handler.call(cmd, args)
@@ -51,7 +51,7 @@ module Fuelcell
51
51
  end
52
52
  end
53
53
 
54
- format_return(cmd, opts, args, ignores)
54
+ format_return(cmd, opts, cmd_args, args, ignores)
55
55
  end
56
56
 
57
57
  private
@@ -67,8 +67,9 @@ module Fuelcell
67
67
  args
68
68
  end
69
69
 
70
- def format_return(cmd, opts, args, ignores)
70
+ def format_return(cmd, opts, cmd_args, args, ignores)
71
71
  {
72
+ cmd_args: cmd_args,
72
73
  cmd: cmd,
73
74
  opts: opts,
74
75
  args: args,
@@ -1,3 +1,3 @@
1
1
  module Fuelcell
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuelcell
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
  - Robert Scott-Buccleuch