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

Fix CLI help messages #4948

Merged
merged 2 commits into from
Feb 4, 2025
Merged

Fix CLI help messages #4948

merged 2 commits into from
Feb 4, 2025

Conversation

edewata
Copy link
Contributor

@edewata edewata commented Feb 3, 2025

Previously if a user called pki-server CLI with a wrong sub-command the ArgumentParser would show an auto-generated error message which looks significantly different from help message already defined in print_help().

To fix the issue the PKIServerCLI.create_parser() and execute() have been modified to use remainder instead of subparsers, and the create_parser() in the sub-commands has been modified to create a regular ArgumentParser instead of a subparser.

Similar changes were made to the CLI base class to fix the help messages for sub-commands (e.g. pki-server ca).

The pki-server has also been modified to provide a --version option to show the version number of the tool.

A new CLIException has been added to distinguish a normal CLI error (which will generate a simple error message such as Invalid module) from an unexpected exception which will generate a full stack trace.

Some tests have been added to check the help and error messages generated by pki and pki-server CLIs.

Resolves: #4932

Previously if a user called pki-server CLI with a wrong
sub-command the ArgumentParser would show an auto-generated
error message which looks significantly different from the
help message already defined in print_help().

To fix the issue the PKIServerCLI.create_parser() and
execute() have been modified to use remainder instead of
subparsers, and the create_parser() in the sub-commands has
been modified to create a regular ArgumentParser instead of
a subparser.

Similar changes were made to the CLI base class to fix the
help messages for sub-commands (e.g. pki-server ca).

The pki-server has also been modified to provide a --version
option to show the version number of the tool.

A new CLIException has been added to distinguish a normal
CLI error (which will generate a simple error message such
as "Invalid module") from an unexpected exception which will
generate a full stack trace.

Resolves: dogtagpki#4932
Some tests have been added to check the help and error messages
generated by pki and pki-server CLIs.
@edewata edewata requested a review from fmarco76 February 3, 2025 17:50
Copy link

sonarqubecloud bot commented Feb 3, 2025

Copy link
Member

@fmarco76 fmarco76 left a comment

Choose a reason for hiding this comment

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

LGTM

@edewata
Copy link
Contributor Author

edewata commented Feb 4, 2025

@fmarco76 Thanks!

@edewata edewata merged commit 4719da0 into dogtagpki:master Feb 4, 2025
168 of 173 checks passed
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.

available sub-commands are not displayed for pki-server <sub-command> --help
2 participants