diff options
author | Noah Kantrowitz <noah@coderanger.net> | 2018-07-10 18:47:18 -0700 |
---|---|---|
committer | Noah Kantrowitz <noah@coderanger.net> | 2018-07-10 18:47:18 -0700 |
commit | c78512254c655de1d66d0a300b5a7db4cd09adce (patch) | |
tree | 07017ad1aea4725bcc0c01ab309aa5415f87bceb /lib/chef/knife.rb | |
parent | 41881272af33a831baec0c491565586cd5f1b77f (diff) | |
download | chef-c78512254c655de1d66d0a300b5a7db4cd09adce.tar.gz |
Add support for knife commands with hyphens.
This works exactly like with an underscore, but is a bit more user-friendly sometimes (e.g. `get_config` vs `get-config`).
Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
Diffstat (limited to 'lib/chef/knife.rb')
-rw-r--r-- | lib/chef/knife.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb index e28ca81f71..6e525bdf3d 100644 --- a/lib/chef/knife.rb +++ b/lib/chef/knife.rb @@ -304,8 +304,12 @@ class Chef # knife node run_list add requires that we have extra logic to handle # the case that command name words could be joined by an underscore :/ - command_name_words = command_name_words.join("_") - @name_args.reject! { |name_arg| command_name_words == name_arg } + command_name_joined = command_name_words.join("_") + @name_args.reject! { |name_arg| command_name_joined == name_arg } + + # Similar handling for hyphens. + command_name_joined = command_name_words.join("-") + @name_args.reject! { |name_arg| command_name_joined == name_arg } if config[:help] msg opt_parser |