-
Notifications
You must be signed in to change notification settings - Fork 669
Re-enable command specific help messages #732
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
Conversation
This makes sure that the global help message wont be printed instead of the command spedific one unless we fail to read the configuration file
Good, it seems to work (within argparse limits). This certainly fixes the main problem of the CLI help - that you weren't able to obtain a proper advice on available parameters. But when you use wrong arguments (e.g. Unfortunately, I think these problems are built into I suggest to replace it with Click. I was playing with click too, and I was able to make it work very good for a script similar to gitlab. |
Sure, I can see your point. And yes, Click seems like a nice fit... |
What I meant to say is that I could help out with moving to Click if you want, just that perhaps we separate that out into another patch, so that we dont delay this one... |
I am not a maintainer of the project, so I cannot decide about the move to Click. I have created issue #733 for this purpose. |
@max-wittig , sure, I can work with @xarx00 to move to click. |
gitlab/cli.py
Outdated
@@ -150,6 +147,9 @@ def main(): | |||
options.config_file | |||
) | |||
except gitlab.config.ConfigError as e: | |||
if "--help" in sys.argv or "-h" in sys.argv: | |||
parser.print_help() | |||
exit(0) |
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.
please use sys.exit(0)
like below
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.
please use sys.exit(0) like below
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.
please use sys.exit(0) like below
OK, done... (also fixed another location I found using exit instead of sys.exit) |
This makes sure that the global help message wont be printed instead of the command specific one unless we fail to read the configuration file
Currently if you try, for example:
gitlab project list --help
you only get the global argument help message