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

--help --verbose shows stack trace #36

Closed
mrackwitz opened this issue Jul 21, 2014 · 7 comments · Fixed by #37
Closed

--help --verbose shows stack trace #36

mrackwitz opened this issue Jul 21, 2014 · 7 comments · Fixed by #37

Comments

@mrackwitz
Copy link
Member

If you call a command with --verbose and --help in combination, CLAide shows a stack trace at the end of the printed help text.

$ ruby examples/make.rb --help --verbose | sed -e "s|$(pwd)|INSTALL_PATH|g"
Usage:

    $ make COMMAND

      Make delicious beverages from the comfort of yourterminal.

Commands:

    + coffee                   Drink brewed from roasted coffee beans
    + tea                      Drink based on cured leaves

Options:

    --no-milk                  Don’t add milk to the beverage
    --sweetner=[sugar|honey]   Use one of the available sweetners
    --completion-script        Print the auto-completion script
    --version                  Show the version of the tool
    --verbose                  Show more debugging information
    --no-ansi                  Show output without ANSI codes
    --help                     Show help banner of specified command

REPO/lib/claide/command.rb:338:in `help!'
REPO/lib/claide/command.rb:456:in `help!'
REPO/lib/claide/command.rb:424:in `validate!'
examples/make.rb:34:in `validate!'
REPO/lib/claide/command.rb:270:in `run'
examples/make.rb:143:in `<main>'
@segiddins
Copy link
Member

Actually, I'm not sure that this is a bug. --verbose prints a stack trace for any uncaught exception. @irrationalfab, can I close this?

@alloy
Copy link
Member

alloy commented Jul 22, 2014

Printing the backtrace when the --verbose option is given is by design. While it makes less sense in the case of --help, I’d prefer that logic to stay simple and consistent.

@alloy alloy closed this as completed Jul 22, 2014
@fabiopelosin
Copy link
Member

@alloy why is the help an exception?

@alloy
Copy link
Member

alloy commented Jul 22, 2014

@irrationalfab I assume you mean the help! method? It’s so you can find the location in the source where from the apparent inability to do something is raised, making it easier to debug and fix/enhance.

@fabiopelosin
Copy link
Member

I think that it should not be an exception if invoked by the --help flag.

@alloy
Copy link
Member

alloy commented Jul 22, 2014

Ok, that’s fair, so it should just print and exit from here.

@mrackwitz Are you willing to look into whipping up a patch for this?

@mrackwitz
Copy link
Member Author

@alloy: Done. See #37.

fabiopelosin added a commit that referenced this issue Jul 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants