usnistgov/oscal-cli

The CLI does not report which flags are required for an operation

nikitawootten-nist opened this issue · 1 comments

Describe the bug

The CLI does not indicate which flags are required to perform a given operation, either in the help text or as an error message.

Who is the bug affecting?

Users of the CLI

What is affected by this bug?

All CLI operations that have required flags

When does this occur?

When a user omits a required flag

How do we replicate the issue?

$ oscal-cli profile convert basic-profile.json output-basic-profile.xml
usage: oscal-cli profile convert [<options>] <source file> [<destination file>]
 -h,--help               display this help message
    --no-color           do not colorize output
    --overwrite          overwrite the destination if it exists
 -q,--quiet              minimize output to include only errors
    --show-stack-trace   display the stack trace associated with an error
    --to <FORMAT>        convert to format: xml, json, or yaml
    --version            display the application version

In the above snippet it is not clear to the user why the command is invalid.
It does not report any error (in this case, that the --to flag is required).

Expected behavior (i.e. solution)

  1. The help text is supplemented with the missing argument:

    ERROR: Missing required flag "--to"
    
  2. The help text indicates which flags are required:

    $ oscal-cli profile convert basic-profile.json output-basic-profile.xml
    usage: oscal-cli profile convert --to <FORMAT> [<options>] <source file> [<destination file>]
    -h,--help               display this help message
        --no-color           do not colorize output
        --overwrite          overwrite the destination if it exists
    -q,--quiet              minimize output to include only errors
        --show-stack-trace   display the stack trace associated with an error
        --to <FORMAT>        convert to format: xml, json, or yaml
        --version            display the application version
    

@aj-stein-nist needs to review this issue and determine viability or feasibility for upcoming release or following release given level of effort.