-
Notifications
You must be signed in to change notification settings - Fork 170
Conversation
@danielsdeleo is there a way to do this for -h as well. |
Do the same thing with https://github.com/opscode/chef-dk/blob/aaa1b79feaa7062cf0a812ef0c0aa27735a63cab/lib/chef-dk/command/base.rb#L65 I think |
74a0252
to
abad73a
Compare
abad73a
to
6fc9f23
Compare
Is there already an existing test that validates 👍 other than that |
def needs_help?(params) | ||
cmd_idx = params.find_index {|x| !x.start_with? '-'} | ||
switch_idx = params.find_index {|x| ['-h', '--help'].include? x} | ||
if cmd_idx && switch_idx && cmd_idx < switch_idx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just check if the first parameter is -h
or --help
? Why do this more complicated thing instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really have a good answer for you other than that is just the way I was thinking about what I wanted to do at the time. Checking the first parameter would indeed be simpler.
Ill update the PR in a bit
@danielsdeleo simplified |
👍 |
Pass version to command when execing
Revert the Ruby version on windows to 2.0.0-p451
Solves Issue #244
-h
will be passed only if it is in the correct position-v
will be passed regardless, however we might want to use the same logic as for-h
cc @opscode/client-engineers