Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

Pass version to command when execing #255

Merged
merged 6 commits into from
Dec 6, 2014
Merged

Conversation

jaym
Copy link
Contributor

@jaym jaym commented Dec 2, 2014

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

@jaym
Copy link
Contributor Author

jaym commented Dec 2, 2014

@danielsdeleo is there a way to do this for -h as well.
It seems that the format we want is chef exec [-chefdk_options] executable [args]

@danielsdeleo
Copy link
Contributor

@jaym jaym force-pushed the jdmundrawala/exec-version branch from 74a0252 to abad73a Compare December 3, 2014 00:54
@jaym jaym force-pushed the jdmundrawala/exec-version branch from abad73a to 6fc9f23 Compare December 3, 2014 01:07
@tyler-ball
Copy link
Contributor

Is there already an existing test that validates chef -v gem returns the ChefDK version banner? I see the new ones for chef -h gem

👍 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
Copy link
Contributor

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?

Copy link
Contributor Author

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

@jaym
Copy link
Contributor Author

jaym commented Dec 4, 2014

@danielsdeleo simplified

@danielsdeleo
Copy link
Contributor

👍

jaym added a commit that referenced this pull request Dec 6, 2014
@jaym jaym merged commit 9203008 into master Dec 6, 2014
ksubrama pushed a commit that referenced this pull request Jan 11, 2016
Revert the Ruby version on windows to 2.0.0-p451
@jaym jaym deleted the jdmundrawala/exec-version branch January 27, 2016 04:49
@chef-boneyard chef-boneyard locked and limited conversation to collaborators Feb 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants