Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tj/commander.js
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v4.1.1
Choose a base ref
...
head repository: tj/commander.js
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.0.0
Choose a head ref

Commits on Dec 11, 2019

  1. Run default command if it's not just * (#1062)

    * Run default command if it's not just *
    
    * Fix lint error
    
    * Add prgm action, only emit command:* when it's registered
    
    * Test asterisk handler not called without args
    
    * Restore check to not call program when signature wrong, and expand program tests
    
    * Document and rework and extend asterisk tests
    
    * Update * and program-action logic based on PR feedback
    
    * Rename program-action to program-command
    
    * Remove unnecessary command listener
    zephraph authored and shadowspawn committed Dec 11, 2019
    Copy the full SHA
    4fb9ed4 View commit details

Commits on Dec 29, 2019

  1. Copy the full SHA
    dd23b4c View commit details

Commits on Jan 1, 2020

  1. Copy the full SHA
    80b3587 View commit details

Commits on Jan 7, 2020

  1. Merge branch 'develop' into release/5.x

    With 4.1 release
    shadowspawn committed Jan 7, 2020
    Copy the full SHA
    491b2e4 View commit details

Commits on Jan 9, 2020

  1. fix option type definition to match usage. (#1119)

    * fix option type def
    
    * add test
    improve types
    
    * change definition order
    
    * change def order
    
    * fix typing
    
    * improve typing enforce current implementation
    
    * final patch
    
    * drop all void returning option
    
    * fix missing boolean type for default value
    
    * clean code
    
    * clean code
    UrielCh authored and shadowspawn committed Jan 9, 2020
    Copy the full SHA
    68e584f View commit details

Commits on Jan 11, 2020

  1. Remove EventEmitter from TypeScript definition file (#1146)

    * Remove NodeJS.EventEmitter from TypeScript definition
    
    * Add symbol
    
    It is JavaScript not node and ok to include to match EventEmitter defintition
    shadowspawn authored Jan 11, 2020
    Copy the full SHA
    c448afb View commit details

Commits on Jan 15, 2020

  1. parseOptions rework phase 1 (#1138)

    * Remove openIssues test for #1062, fixed and being tested
    
    * Rework parseOptions handling of unknown arguments
    
    * First tests for parseOptions, enable prepared regression tests
    
    * Add tests for parseOptions
    
    * Add tests on program.args after calling parse
    
    * Minor update to README for changed parse behaviour
    
    * Tweak inline .parseOption examples
    shadowspawn authored Jan 15, 2020
    Copy the full SHA
    62234f6 View commit details

Commits on Jan 21, 2020

  1. Combine normalize and parseoptions, and update combined option handli…

    …ng (#1152)
    
    * Add tests for Utility Conventions before changing code to match
    
    * Switch from preflight including normalise to just testing parseOptions
    
    * Only refactor known options
    
    Do the work in .parseOptions and delete single-pass .normalize
    
    * Add short flag processing to READMEm, and literal --
    
    * Improve character description
    
    * Add a note that options not positional.
    
    * Remove regression tests for bug not really fixed by this
    
    * Add back #561 into known issues
    
    * Refactor to make a little clearer and symmetrical
    
    * Use template to construct strings consistently within parseOptions
    shadowspawn authored Jan 21, 2020
    Copy the full SHA
    1691344 View commit details

Commits on Jan 31, 2020

  1. Parse rework for nested commands (#1149)

    * First cut at parse rework
    
    - skip asterisk tests
    - other tests runnning
    - nested commands untested
    - lots of details to check
    
    * Add check for requiredOption when calling executable subcommand
    
    * Set program name using supported approach
    
    * Add .addCommand, easy after previous work
    
    * Add support for default command using action handler
    
    - and remove stale _execs
    
    * Add implicitHelpCommand and change help flags description
    
    * Add implicit help command to help
    
    * Turn off implicit help command for most help tests
    
    * .addHelpCommand
    
    * Remove addHelpCommand from tests and make match more narrow
    
    * Use test of complete default help output
    
    * Add tests for whether implicit help appears in help
    
    * Add tests that help command dispatched to correct command
    
    * Add simple nested subcommand test
    
    * Add default command tests for action based subcommand
    
    * Remove mainModule, out of scope for current PR
    
    * Add legacy asterisk handling and tests
    
    * Add more initialisation so object in known state
    
    * Tests for addCommand
    
    * Add first cut at enhanced default error detection
    
    * Add test that addCommand requires name
    
    * Add block on automatic name generation for deeply nested executables
    
    * Add block on automatic name generation for deeply nested executables
    
    * Fix describe name for tests
    
    * Refine unknownCommand handling and add tests
    
    * Add suggestion to try help, when appropriate
    
    * Fix typo
    
    * Move common command configuration options in README, and add isDefault example program
    
    * Add isDefault and example to README
    
    * Add nested commands
    
    * Document .addHelpCommand, and tweaks
    
    * Remove old default command, and rework command:* example
    
    * Document .addCommand
    
    * Remove comment referring to removed code.
    
    * Revert the error tip "try --help", not happy with the wording
    
    * Say "unknown command", like "unknown option"
    
    * Set properties to null rather than undefined in constructor
    shadowspawn authored Jan 31, 2020
    Copy the full SHA
    1345f98 View commit details
  2. Copy the full SHA
    30368b8 View commit details
  3. Copy the full SHA
    3e5b05e View commit details

Commits on Feb 1, 2020

  1. Preparing for 5.0.0-0 (#1162)

    * First collection
    
    * Second draft
    
    * Bump version (not tagged)
    
    * Add issue links
    
    * Links not displaying correctly, debugging
    
    * More experimenting
    
    * Restore links, try again
    
    * Add CHANGELOG entry for removing EventEmitter from TypeScript
    shadowspawn authored Feb 1, 2020
    Copy the full SHA
    6857562 View commit details
  2. Add VSCode tip and rework debugging

    Co-authored-by: James Renaud <james.renaud@mitel.com>
    shadowspawn and James Renaud committed Feb 1, 2020
    Copy the full SHA
    dd68652 View commit details

Commits on Feb 2, 2020

  1. Merge pull request #1166 from shadowspawn/feature/vscode-debugging

    Add VSCode tip and rework debugging section
    shadowspawn authored Feb 2, 2020
    Copy the full SHA
    3ab2196 View commit details
  2. Copy the full SHA
    cb84f6e View commit details

Commits on Feb 5, 2020

  1. Copy the full SHA
    e242593 View commit details
  2. Throw for author errors and improve (#1165)

    * Throw errors for author errors. Detect bad variadic when added.
    
    * Throw errors for author errors. Detect bad variadic when added.
    shadowspawn authored Feb 5, 2020
    Copy the full SHA
    d9ac483 View commit details
  3. Update dependencies and rewrite tests (#1167)

    * Update dependencies
    
    - fix or disable new Jest tests
    - stick with LTS node version
    
    * Rework exec tests to use promises instead of jest callback
    
    * Suppress warning
    
    * Turn warning back on, fixing
    
    * Fix lint warnings and reduce use of callback
    shadowspawn authored Feb 5, 2020
    Copy the full SHA
    d736ff7 View commit details
  4. Copy the full SHA
    28af796 View commit details
  5. Copy the full SHA
    2ca5bc7 View commit details
  6. Copy the full SHA
    5893177 View commit details

Commits on Feb 6, 2020

  1. Copy the full SHA
    5f725f6 View commit details
  2. Make .helpInformation public and update help sections in README (#1169)

    * Make example shorter
    
    * Focus on point of example, shorten code
    
    * Make .helpInformation public
    
    * Update mostly help sections
    
    - add .helpInformation
    - shorten related examples
    - remove callback example
    - add links to example code
    
    * Add simple calls to help function to typings test
    shadowspawn authored Feb 6, 2020
    Copy the full SHA
    a094ef2 View commit details
  3. Replace git-style wording from README (#1171)

    * Remove git-style from docs
    
    * Remove stale comment
    shadowspawn authored Feb 6, 2020
    Copy the full SHA
    fbdd132 View commit details

Commits on Feb 7, 2020

  1. Parse argument conventions (#1172)

    * Add "from"  parameter to .parse()
    
    * Add docs for ParseOptions
    
    * Add .parse options to README
    
    * Lint, whitespace
    
    * Fill in parseAsync docs
    shadowspawn authored Feb 7, 2020
    Copy the full SHA
    30ae4ac View commit details

Commits on Feb 8, 2020

  1. Preparing for 5.0.0-1 prerelease (#1174)

    * Add help information
    
    * Add error changes to changelog
    
    * Add .parse enhancements to CHANGELOG
    
    * List error changes separately
    
    * Bump version
    
    * Fix 4.1.1 link
    shadowspawn authored Feb 8, 2020
    Copy the full SHA
    1e1ed08 View commit details
  2. Copy the full SHA
    6f3aebb View commit details
  3. Copy the full SHA
    a8a14c9 View commit details

Commits on Feb 10, 2020

  1. Copy the full SHA
    1704022 View commit details
  2. Suggest help when unknown command (#1179)

    * Suggest help when unknown command
    
    * Use custom help flag in message
    shadowspawn authored Feb 10, 2020
    Copy the full SHA
    28b649d View commit details
  3. Copy the full SHA
    31f1878 View commit details

Commits on Feb 11, 2020

  1. Copy the full SHA
    1a84b80 View commit details
  2. Copy the full SHA
    729e432 View commit details
  3. Copy the full SHA
    08ec04e View commit details

Commits on Feb 12, 2020

  1. Add parse result test (#1188)

    * Add missing changelog entry
    
    * Add test on parse return type
    shadowspawn authored Feb 12, 2020
    Copy the full SHA
    733047f View commit details
  2. Copy the full SHA
    46f886f View commit details

Commits on Feb 14, 2020

  1. Added fail-fast: false to GitHub actions settings (#1187)

    All tests are run, so it is easier to see which environment failed.
    abetomo authored Feb 14, 2020
    Copy the full SHA
    516a14c View commit details

Commits on Feb 15, 2020

  1. update Readme_zh-CN.md for v5.0

    oGsLP authored and abetomo committed Feb 15, 2020
    Copy the full SHA
    bdad7dc View commit details
  2. URLEncode several chinese toc link

    oGsLP authored and abetomo committed Feb 15, 2020
    Copy the full SHA
    2491c76 View commit details
  3. Copy the full SHA
    77e511f View commit details
  4. Copy the full SHA
    0a50bd6 View commit details

Commits on Feb 20, 2020

  1. Copy the full SHA
    1757564 View commit details
  2. Copy the full SHA
    87bfca6 View commit details
  3. 5.0.0-3

    shadowspawn committed Feb 20, 2020
    Copy the full SHA
    a3f453f View commit details

Commits on Feb 21, 2020

  1. Expand typescript checks (#1198)

    * Add proof of concept Command type without option properties
    
    * Add program
    
    * Add tests for exported global, and start refactoring existing tests
    
    * Methodically test syntax, instead of just lots of README and example code
    shadowspawn authored Feb 21, 2020
    Copy the full SHA
    3cf8cff View commit details

Commits on Mar 1, 2020

  1. Copy the full SHA
    3c9f33f View commit details

Commits on Mar 2, 2020

  1. createCommand factory routine (#1191)

    * Add factory method
    
    * Fix return doc
    
    * Can not use "this" for return type of createCommand
    
    * Use return type of createCommand for subcommand
    
    * Add mention of .command from .createCommand
    
    * Remove trailing space
    
    * Add examples for createCommand
    
    * Explain example and make a little more realistic
    
    * Add  comments pointing from .addCommand to .command
    
    One of the downsides of extra ways of adding and creating commands is confusion with the more common way.
    
    * Add createCommand to README
    
    * Shift command/subcommand contrast
    
    * Use single quotes in ts like in js, and clean up whitespace in new code
    shadowspawn authored Mar 2, 2020
    Copy the full SHA
    8c3dd6f View commit details

Commits on Mar 3, 2020

  1. Add factory to CHANGELOG

    shadowspawn committed Mar 3, 2020
    Copy the full SHA
    bd5a49e View commit details
  2. 5.0.0-4

    shadowspawn committed Mar 3, 2020
    Copy the full SHA
    95e0d19 View commit details

Commits on Mar 4, 2020

  1. Add eslint settings for TypeScript (#1205)

    * wip: Proposal of eslint setting of TypeScript.
    
    * Add eslint settings for TypeScript
    
    * Modify TypeScript lint target file
    abetomo authored Mar 4, 2020
    Copy the full SHA
    f14df07 View commit details
Showing with 5,438 additions and 4,331 deletions.
  1. +0 −2 .eslintignore
  2. +50 −0 .eslintrc.js
  3. +0 −10 .eslintrc.json
  4. +1 −0 .github/workflows/tests.yml
  5. +126 −207 CHANGELOG.md
  6. +145 −121 Readme.md
  7. +125 −114 Readme_zh-CN.md
  8. +1 −2 SECURITY.md
  9. +207 −0 changelogs/CHANGELOG-2.md
  10. +36 −0 examples/custom-command-class.js
  11. +36 −0 examples/custom-command-function.js
  12. +4 −13 examples/custom-help
  13. +36 −0 examples/defaultCommand.js
  14. +1 −7 examples/deploy
  15. +47 −0 examples/nestedCommands.js
  16. +1 −3 examples/pizza
  17. +1 −1 examples/pm-install
  18. +1,371 −1,308 index.js
  19. +1,955 −2,057 package-lock.json
  20. +15 −8 package.json
  21. +3 −3 tests/args.literal.test.js
  22. +5 −13 tests/args.variadic.test.js
  23. +34 −3 tests/command.action.test.js
  24. +69 −0 tests/command.addCommand.test.js
  25. +1 −1 tests/command.allowUnknownOptions.test.js
  26. +112 −28 tests/command.asterisk.test.js
  27. +2 −2 tests/command.commandHelp.test.js
  28. +58 −0 tests/command.default.test.js
  29. +0 −27 tests/command.executableSubcommand.default.test.js
  30. +27 −40 tests/command.executableSubcommand.inspect.test.js
  31. +45 −60 tests/command.executableSubcommand.lookup.test.js
  32. +3 −1 tests/command.executableSubcommand.signals.test.js
  33. +24 −45 tests/command.exitOverride.test.js
  34. +4 −3 tests/command.help.test.js
  35. +100 −0 tests/command.helpCommand.test.js
  36. +12 −0 tests/command.nested.test.js
  37. +74 −0 tests/command.parse.test.js
  38. +291 −0 tests/command.parseOptions.test.js
  39. +64 −0 tests/command.unknownCommand.test.js
  40. +1 −1 tests/command.unknownOption.test.js
  41. +4 −4 tests/command.usage.test.js
  42. +36 −0 tests/createCommand.test.js
  43. +1 −1 tests/fixtures/inspect.js
  44. +1 −1 tests/fixtures/pm-cache.js
  45. +8 −5 tests/helpwrap.test.js
  46. +2 −70 tests/openIssues.test.js.skip
  47. +3 −1 tests/options.mandatory.test.js
  48. +1 −0 tests/options.values.test.js
  49. +20 −0 tests/program.test.js
  50. +187 −138 typings/commander-tests.ts
  51. +88 −31 typings/index.d.ts
2 changes: 0 additions & 2 deletions .eslintignore

This file was deleted.

50 changes: 50 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
const javascriptSettings = {
files: ['*.js'],
extends: [
'standard',
'plugin:jest/recommended'
],
rules: {
'no-else-return': ['error', { allowElseIf: false }],
'no-var': 'warn',
'one-var': 'off',
'space-before-function-paren': ['error', 'never'],
semi: ['error', 'always']
},
}

const typescriptSettings = {
files: ['*.ts'],
extends: ['standard-with-typescript'],
parserOptions: {
project: './tsconfig.json'
},
rules: {
'no-else-return': ['error', { allowElseIf: false }],
'no-var': 'warn',
'one-var': 'off',
'space-before-function-paren': ['error', 'never'],
semi: ['error', 'always'],
'@typescript-eslint/member-delimiter-style': [
'error',
{
multiline: {
delimiter: 'semi',
requireLast: true
},
singleline: {
delimiter: 'semi',
requireLast: false
}
}
]
}
}

module.exports = {
plugins: ['jest'],
overrides: [
javascriptSettings,
typescriptSettings
]
}
10 changes: 0 additions & 10 deletions .eslintrc.json

This file was deleted.

1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ jobs:
name: Test on node ${{ matrix.node-version }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node-version: [8.x, 10.x, 12.x]
os: [ubuntu-latest, windows-latest, macos-latest]
Loading