Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhance Option class to allow hiding help, specifying choices, and ch…
…ange how default value displayed in help (#1331) * Add .addOption and use as bottleneck. Make all Option properties private. * Desription for object is optional * Add support for hidden options * Try setFoo for booleans so less ambiguous what no parameter means * Renamed method * Restore Option property names to reduce churn * Try more fluent names for non-property methods * Avoid renaming existing members of Option * Add default description for help * Fix return JSDoc * First cut at choices * Throw CommanderError for easier detection * Add catch for tidy coercion failure handing * Add tests for Option.choices * Rename custom option processing property * Add run script for TypeScript checkJS * Add tests for chaining routines * More consistent name for custom option arg processing * Add choices to help * .default() now expects parameter * Fixed return type * Separate out argumentRejected for possible reuse * Add back support for RegExp which accidentally dropped. * Add test for obsolete regexp * Add TypeScript definitions for new Option properties * Switch from obsolete to deprecated, clearer meaning * Fix left-over edit * Add comment * Simplify the comments * Add README and example file * Remove example covered elsewhere * Restore example, leave change for a separate PR * Fix example output to match changed code * Add language to code blocks * Rename getFullDescription, not using get much * Add chaining test for addHelpText * Describe as legacy rather than deprecated in comments, add @deprecated for editor feedback to discourage use * Do not have to have both should and long flags these days * Eliminate duplicate code using internal knowledge * Rename parseArgWith to argParser * Improve JSDoc for help * Make code and declarations consistent to pass tsc checks * Match up write signature to fix linting error * Restore "deprecated", it is the right word
- Loading branch information