clutz icon indicating copy to clipboard operation
clutz copied to clipboard

Help text displays incorrect defaults when invalid options passed

Open whymarrh opened this issue 8 years ago • 0 comments

In preparing #586 I came across the following behaviour that I don't think is correct. When a mix of valid and invalid options are passed the values for the valid options seem to show up as the "defaults" in their help text.

An example:

clutz (development %=) $ ./build/install/clutz/bin/clutz --externs foo bar 'foo bar' baz --help
"--help" is not a valid option
Usage: clutz [options...] arguments...
 --closure_entry_points ENTRYPOINT... : only generate output for the given
                                        entry points to the program. Must be
                                        goog.provide'd symbols.
 --debug                              : run in debug mode (prints compiler
                                        warnings) (default: false)
 --depgraphs file.depgraph...         : only generate output for files listed
                                        as a root in the given depgraphs
 --depgraphs_filter_sources           : only include sources from the arguments
                                        list that appear in the given depgraphs
                                        (default: false)
 --emitPlatformExterns                : emits platform externs, instead of
                                        omitting them in favor of TS lib.d.ts
                                        (default: false)
 --externs EXTERN...                  : list of files to read externs
                                        definitions (as separate args)
                                        (default: [foo,bar,foo,bar,baz])
 --partialInput                       : allow input of incomplete programs. All
                                        unknown types will be treated as
                                        forward declared. (default: false)
 --skipEmitRegExp VAL                 : Symbols in files that match this RegExp
                                        will not be included in the emit. Note
                                        thatthe files would still be part of
                                        the internal compilation.
 --strict_deps                        : generates no modules for nonroots (but
                                        does generate types), so that nonroots
                                        cannot be imported by TypeScript code.
                                        (default: false)
 -o OUTPUT                            : output to this file (default: -)

Note the help text for --externs:

 --externs EXTERN...                  : list of files to read externs
                                        definitions (as separate args)
                                        (default: [foo,bar,foo,bar,baz])

Is seems that the values passed show up as the "default" value for the option which doesn't seem right. I imagine this could cause a good bit of confusion if this is your first interaction with the help text.

whymarrh avatar Nov 18 '17 19:11 whymarrh