#982 RFE: Consider replacing CLI command-line parser to account equally for arguments and options
Closed: migrated 3 years ago by dmoluguw. Opened 9 years ago by rpattath.

[root@sigma dogtag]# pki group-add

Error: Missing required option: description
usage: group-add <Group ID> [OPTIONS...]
    --description <description>   Description
    --help                        Show help options

Missing <Group ID> is not reported.


As discussed on IRC, this would more than likely require a change to the way that the command-line is currently parsed by the CLI tools (possibly using some classes other than the Apache Commons CLI Options/Option classes).

Currently, the following procedures are followed:

  • check for "--help" on the command-line, and if present display command usage
  • parse the lines, failing with an exception on any missing required "option" where an option is of the form "--<option> option_value"; note that "option" parameters utilize the following two classes:
  • check for the valid number of "arguments" (e. g. - <Group ID>)

proposed milestone: 10.3

It might be possible to fix this by making the options optional during parsing, then checking for required options manually after that.

So the steps are:

  • create all options (everything is optional)
  • parse the command line (to detect illegal options)
  • check for --help
  • check for number of arguments
  • process the command while checking for missing/extraneous options

What happens if you specify the "description", but only leave out the "Group ID"? I'd like to see the actual message.

Replying to [comment:4 nkinder]:

What happens if you specify the "description", but only leave out the "Group ID"? I'd like to see the actual message.

If a "--description <description>" were specified, the following message would be returned:

Error: No Group ID specified.
usage: group-add <Group ID> [OPTIONS...]
    --description <description>   Description
    --help                        Show help options

As explained above, this behavior is exactly as described above.

However, rather than closing this ticket, I am going to re-title it and move it to 10.4.

Metadata Update from @rpattath:
- Issue set to the milestone: UNTRIAGED

7 years ago

Dogtag PKI is moving from Pagure issues to GitHub issues. This means that existing or new
issues will be reported and tracked through Dogtag PKI's GitHub Issue tracker.

This issue has been cloned to GitHub and is available here:
https://github.com/dogtagpki/pki/issues/1548

If you want to receive further updates on the issue, please navigate to the
GitHub issue and click on Subscribe button.

Thank you for understanding, and we apologize for any inconvenience.

Metadata Update from @dmoluguw:
- Issue close_status updated to: migrated
- Issue status updated to: Closed (was: Open)

3 years ago

Login to comment on this ticket.

Metadata