Skip to content

Upgrading commander 12 to 13

Breaking12.1.0 → 13.1.0Breaking4New7Changed1

BreakingUpgrade verdict

4 breaking changes.

  • Passing more arguments than the program expects is now an error unless you allow it.
  • Creating an option with an invalid flag now fails immediately instead of being accepted.
  • Calling the parser more than once is now an error when options are stored as properties.
  • The old help wrapping method is removed and replaced by two new methods.
Top 3 of 4 that need code or config changes
Breaking4
Excess command-arguments cause an error by default.
allowExcessArguments
Throws during Option construction for unsupported option flags, like multiple characters after single -.
Option
Throws on multiple calls to .parse() if storeOptionsAsProperties is true.
.parse()storeOptionsAsProperties
Help.wrap() is refactored into formatItem() and boxWrap().
Help.wrap()formatItem()boxWrap()

Generated by DepDelta from published .d.ts files. Not mixed with prose notes.

  • removed: method Help.wrap(str: string, width: number, indent: number, minColumnWidth?: number): string
  • changed: method Command.action(fn: (...args: any[]) => void | Promise<void>): this → method Command.action(fn: (this: this, ...args: any[]) => void | Promise<void>): this
  • added: method Command.restoreStateBeforeParse(): void
  • added: method Command.saveStateBeforeParse(): void
  • added: method Help.boxWrap(str: string, width: number): string
  • added: method Help.displayWidth(str: string): number
  • added: method Help.formatItem(term: string, termWidth: number, description: string, helper: Help): string
  • added: method Help.preformatted(str: string): boolean
  • added: method Help.prepareContext(contextOptions: { error?: boolean; helpWidth?: number; outputHasColors?: boolean }): void
  • added: method Help.styleArgumentDescription(str: string): string
  • added: method Help.styleArgumentTerm(str: string): string
  • added: method Help.styleArgumentText(str: string): string
  • added: method Help.styleCommandDescription(str: string): string
  • added: method Help.styleCommandText(str: string): string
  • added: method Help.styleDescriptionText(str: string): string
  • added: method Help.styleOptionDescription(str: string): string
  • added: method Help.styleOptionTerm(str: string): string
  • added: method Help.styleOptionText(str: string): string
  • added: method Help.styleSubcommandDescription(str: string): string
  • added: method Help.styleSubcommandTerm(str: string): string
  • added: method Help.styleSubcommandText(str: string): string
  • added: method Help.styleTitle(title: string): string
  • added: method Help.styleUsage(str: string): string
  • added: method OutputConfiguration.getErrHasColors?(): boolean
  • added: method OutputConfiguration.getOutHasColors?(): boolean
  • added: method OutputConfiguration.stripColor?(str: string): string
  • added: property Help.minWidthToWrap: number