Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes error handling when an invalid flag is passed. #151

Merged
merged 2 commits into from
May 19, 2018

Conversation

jonsmorrow
Copy link
Contributor

Signed-off-by: Jon Morrow jmorrow@chef.io

Signed-off-by: Jon Morrow <jmorrow@chef.io>
@jonsmorrow jonsmorrow requested a review from a team May 18, 2018 20:30
Copy link
Member

@marcparadise marcparadise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just a minor wording change.

The flag '%1' does not exist.

Available flags are:
%2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This \ gets pretty long (especially with upcoming ssh flags), making it likely someone has to scroll up to see what they did wrong.
Can we do something like:

The flag provided does not exist. 

Available flags are: 
  %2
You gave: 
  %1 

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 copied the format for missing commands.

Copy link
Member

@marcparadise marcparadise May 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That may need a separate PR, though I think the size of the dynamic portion isn't so big there

Copy link
Member

@marcparadise marcparadise May 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finishing the thought: . I'm +1 on landing this as it is for now - I'm planning to take a final pass through all of en.yml and check spelling, grammar, verboseness, word wrapping v term size, consistency, etc and will make tweaks as needed then.

Copy link
Contributor

@tyler-ball tyler-ball left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we should only be making changes to chef-run and deal with the whole chef-cli duplication separately. But these changes look good

@marcparadise
Copy link
Member

@tyler-ball yeah, I have not been duplicating my changes into chef-cli for other things.

@jonsmorrow
Copy link
Contributor Author

i did it on this only because it is likely handling we will need later. but in general yes we should stay in chef-run.

@jonsmorrow
Copy link
Contributor Author

I am going to merge this since it fixes an error condition and matches existing ux style. I'll send a link to @vebberts and we can update in another pass if needed.

@jonsmorrow
Copy link
Contributor Author

jonsmorrow commented May 19, 2018

➜  chef-run git:(jm/fix_invalid_flag_handling) bundle exec bin/chef-run -g

The flag '-g' does not exist.

  Available flags are:
    -c, --config PATH                 Location of config file. Defaults to /Users/jmorrow/.chef-workstation/config.toml
        --cookbook-repo-paths PATH    Comma separated list of cookbook repository paths.
    -h, --help                        Show help and usage for `chef-run`
    -i, --identity-file PATH          SSH identity file to use when connecting.
        --[no-]install                Install Chef client on the target host(s) if it is not installed.
                                      This defaults to enabled - the installation will be performed
                                      if there is no Chef client on the target(s).
        --[no-]root                   Whether to use root permissions on the target. Defaults to true.
    -s, --[no-]ssl                    Use SSL for WinRM. Current default: false
    -s, --[no-]ssl-verify             Verify peer certificate when using SSL for WinRM
                                      Use --ssl-no-verify when using SSL for WinRM and
                                      the remote host is using a self-signed certificate.
                                      Current default: true
    -v, --version                     Show the current version of Chef Run.

@jonsmorrow jonsmorrow merged commit 7f277da into master May 19, 2018
@chef-ci chef-ci deleted the JM/fix_invalid_flag_handling branch May 19, 2018 06:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants