usnistgov/oscal-cli

Convert help subcommand throws an error, requires `--to` argument

Opened this issue · 1 comments

Describe the bug

When updating integration tests for #178, I was attempting to write some smoke tests of the subcommand. The model validate -h command will successfully complete without error (e.g. ExitCode.OK status). On the other hand model convert -h will fail (e.g. ExitCode.INVALID_COMMAND) with an error message after the help menu, while adding tests off of 134d077.

Who is the bug affecting?

Developers wanting to run or test the oscal-cli programmatically.

What is affected by this bug?

Using the help menus on conversion or validation subcommands to ensure the application is properly installed and inspect the error code to be 0 before running more complex operations.

When does this occur?

Consistently.

How do we replicate the issue?

{What are the steps to reproduce the behavior?

  1. Write tests or run the commands like so with a build off of develop with the commit above or newer.
$ oscal-cli ap validate --help
usage: oscal-cli ap validate [<options>] <file to validate>
    --as=<FORMAT>        source format: xml, json, or yaml
 -c <FILE>               additional constraint definitions
 -h,--help               display this help message
    --no-color           do not colorize output
 -q,--quiet              minimize output to include only errors
    --show-stack-trace   display the stack trace associated with an error
    --version            display the application version
$ echo $?
0
$ oscal-cli ap convert --help
usage: oscal-cli ap 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
Missing required option: to
$ echo $?
3

If applicable, add screenshots to help explain your problem.}

Expected behavior (i.e. solution)

{A clear and concise description of what you expected to happen.}

Other Comments

{Add any other context about the problem here.}

Similar issue as usnistgov/metaschema-java#293 (comment), but this is for a primary oscal-cli command and not a "wrapped" metaschema-cli command, will need to be resolved within this code base.