Skip to content

fix(cli): point at --help when arguments are invalid - #870

Open
Sanjays2402 wants to merge 1 commit into
andialbrecht:masterfrom
Sanjays2402:fix/cli-mention-help
Open

fix(cli): point at --help when arguments are invalid#870
Sanjays2402 wants to merge 1 commit into
andialbrecht:masterfrom
Sanjays2402:fix/cli-mention-help

Conversation

@Sanjays2402

Copy link
Copy Markdown

Closes #840

sqlformat with no arguments printed only the usage line and the error, with no hint that --help exists. A small ArgumentParser subclass overrides error() so every argument error is followed by Try 'sqlformat --help' for more information. Exit code stays 2.

Before submitting your pull request please have a look at the
following checklist:

  • ran the tests (pytest)
  • all style issues addressed (ruff)
  • your changes are covered by tests
  • your changes are documented, if needed

Running `sqlformat` with no arguments (or any invalid argument
combination handled by argparse) printed only the usage line and the
error, giving no hint that `--help` exists.

argparse's default `error()` is overridden in a small ArgumentParser
subclass so every argument error is followed by
"Try 'sqlformat --help' for more information." Exit code stays 2.

Closes andialbrecht#840
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.

Mention --help

1 participant