-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extra documentation: deprecated, undocumented, and superseded features #1314
Comments
I started work on this, but having second thoughts. Migration advice might be more useful, and that is included in the Release Notes and CHANGELOG. Adding what I wrote up so searchable in Issues, but not planning to add a separate document at this stage. Unloved FeaturesYou may come across features that are not described in the README: in existing programs, or mentioned in issues, or by inspecting the Commander code. Check here DeprecatedThese features are deprecated, which means they may go away in a future major version of Commander. RegExp Option ParameterThe option method allowed a RegExp as the third parameter to restrict what values were accepted. Removed from README from Commander v3. program.option('-c,--coffee <type>', 'coffee', /short-white|long-black/); The newer functionality is the custom option processing function passed in the same parameter position. command('*')This was called when the command was not known: program.command('*') The newer functionality is setting a command as the default command using the You can also use a listener for noHelpThis was an option passed to program.command('example', 'examnple command', { noHelp: true }); The option has been renamed Default ImportThe default import was a global Command object. const program = require('commander'); The global Command object is exported as const { program } = require('commander');
// or
const { Command } = require('commander');
comnst program = new Command() UnlovedThese legacy features have never been documented in the README. Still unsure whether there are allowUnknownOptionsUsed to suppress the error handling when unknown options are found: program.allowUnknownOptions(); The main effect is simply suppressing the error handling, and the unknown options Argument DescriptionsThe program
.arguments('<file>')
.description('print target file', {
file: 'file to process'
}); |
We could add a separate page, outside the README, for features which are (deliberately) not covered in the README. This includes features which have been replaced by better ways, features which didn't work out and are now deprecated, and features which never got documented and may never make primetime. Sometimes referred to as legacy.
Partly so people can find documentation on old code they find in programs they are maintaining, and partly so people can find out about state of routines they discover looking in the code or through the issues. e.g.
command('*')
.arguments()
).allowUnknownOptions()
The text was updated successfully, but these errors were encountered: