Skip to content
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

Deprecate version retrieval #1954

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions docs/deprecated.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ They are currently still available for backwards compatibility, but should not b
- [InvalidOptionArgumentError](#invalidoptionargumenterror)
- [Short option flag longer than a single character](#short-option-flag-longer-than-a-single-character)
- [Import from `commander/esm.mjs`](#import-from-commanderesmmjs)
- [Version string retrieval](#version-string-retrieval)

## RegExp .option() parameter

Expand Down Expand Up @@ -207,3 +208,17 @@ import { Command } from 'commander';
```

README updated in Commander v9. Deprecated from Commander v9.

## Version string retrieval

The version string passed to `.version()` was stored internally. The string could be accessed two ways, although neither
was ever described in the README.

```js
program.storeOptionsAsProperties();
program.version('1.0.0');
console.log(program.version());
console.log(program.opts().version); // only when using legacy storeOptionAsProperties
``

Deprecated from Commander v11.