Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@caporal/core

mattallty136.1kMIT2.0.7TypeScript support: included

A full-featured framework for building command line applications (cli) with node.js

cli, command, commander, clap, cli-app, minimist, cli-table, command line apps, option, parser, argument, flag, args, argv

readme

Caporal

A full-featured framework for building command line applications (cli) with node.js, including help generation, colored output, verbosity control, custom logger, coercion and casting, typos suggestions, and auto-complete for bash/zsh/fish.

Install

Simply add Caporal as a dependency:

$ npm install @caporal/core

# Or if you are using yarn (https://yarnpkg.com/lang/en/)
$ yarn add caporal @caporal/core

Documentation

Checkout our website https://caporal.io for docs.

License

MIT License

Copyright (c) 2017-present Matthias ETIENNE

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

changelog

Changelog

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

2.0.2 (2020-06-13)

Bug Fixes

  • command: Fix command discovery 47cdb9c

2.0.1 (2020-06-13)

Bug Fixes

  • command: Fix importCommand() to handle both typescript or javascript files fa48857

2.0.0 (2020-06-13)

Bug Fixes

  • use process.exitCode instead of process.exit(1) 19f862c

Features

  • Caporal v2 (#179) 5e3eb2f

BREAKING CHANGES

  • Caporal v2 is not backward compatible with 1.x. v2 is a full rewrite with Typescript which brings a lot of features and fixes to v1.

2.0.0 (2020-06-13)

Bug Fixes

  • use process.exitCode instead of process.exit(1) 19f862c

Features

  • Caporal v2 (#179) 5e3eb2f

BREAKING CHANGES

  • Caporal v2 is not backward compatible with 1.x. v2 is a full rewrite with Typescript which brings a lot of features and fixes to v1.

2.0.0-beta.12 (2020-05-23)

2.0.0-beta.11 (2020-05-23)

2.0.0-beta.10 (2020-05-23)

Bug Fixes

  • use process.exitCode instead of process.exit(1) 19f862c

2.0.0-beta.9 (2020-05-23)

2.0.0-beta.8 (2020-05-23)

2.0.0-beta.7 (2020-05-23)

2.0.0-beta.6 (2020-05-22)

2.0.0-beta.5 (2020-05-22)

2.0.0-beta.4 (2020-05-22)

2.0.0-beta.3 (2020-05-22)

2.0.0-beta.2 (2020-05-21)

2.0.0-beta.1 (2020-05-20)

Features

  • Caporal v2 (#179) 5e3eb2f

BREAKING CHANGES

  • Caporal v2 is not backward compatible with 1.x. v2 is a full rewrite with Typescript which brings a lot of features and fixes to v1.

1.4.0 (2020-05-11)

Bug Fixes

Features

  • Add ability to display stacktraces from unhandled exceptions (#168) (2e1e4ec), closes #168 #166

1.3.0 (2019-07-30)

Bug Fixes

  • validator: Fix function validators for options (d10cd87), closes #149
  • deps upgrade (#157) (798b875), closes #157

1.2.0 (2019-05-11)

Bug Fixes

  • $compile: Extended ts type for logger (#134) (dd0a82e), closes #134
  • autocomplete: Fixes autocompletion of arguments (d3926dd)
  • autocomplete: Various fixes on autocomplete (4c62934)
  • update lodash merge methods and fix other vulns (db19813)
  • help: Fix help usage output (29785c0)
  • validator: Fix validation error for LIST (1669d5f)
  • validator: Improve mandatory option values validation error messages (#139) (6e73a6c), closes #139

Features

  • validator: Promise based validation of arguments and options (6c67c95)

1.1.0 (2018-11-15)

Bug Fixes

1.0.0 (2018-10-24)

This is a major update which drops support for node.js < 6

Bug Fixes

  • A few fixes and improvements (#104) (d712dd8), closes #104
  • exit with status code 1 when command does not exist (#106) (4950a75)
  • fix it.only(...) causing the #118 issue test case to run alone (#124) (801f667), closes #118 #124

Features

  • Implicit boolean option (#109) (bf25c33)

Performance Improvements

  • swap chalk for colorette (#117) (d2fc842)

0.10.0 (2018-02-25)

Bug Fixes

  • $cli: Multi-help sections support (#82) (0d621d0), closes #67 #67
  • Display thrown error message when validation fails (#98) (e4c07a8)
  • Fix #91 typescript types (f35a1f5), closes #91
  • Make usage display name if available (#97) (3be93c5)
  • Small typo/regex issues (a900fc0)

0.9.0 (2017-12-05)

0.8.0 (2017-10-20)

Bug Fixes

  • make wording of error clearer (#76) (c689df3)
  • help: Display other commands when default command is present (#64) (8df56e8)

Features

  • Add Typescript support (#63) (e82fd42)
  • Allow caporal to be used from REPL (#75) (344cc17)

0.7.0 (2017-06-30)

Features

  • logger: allow log level to be passed through env (#58) (2f9e578)

0.6.0 (2017-05-29)

Bug Fixes

  • autocomplete: fix arguments autocompletion (#53) (e21f846), closes #53
  • logger: Fix logger (new line missing) (#54) (ecd145f), closes #54
  • logger: fix logger metadata handling (#55) (d0b9953), closes #55

0.5.0 (2017-04-13)

Bug Fixes

  • validator: fix handling of prog.LIST flag (#43) (d1e429a), closes #43 #39

Features

  • help: Added custom help feature (#47) (3324eec), closes #14
  • program,command: return promise of executed command for facilitate testing (#40) (0d1bd54)

0.4.1 (2017-03-26)

Bug Fixes

  • help: use console.log for help() instead of custom logger (#38) (e00932b), closes #34

0.4.0 (2017-03-26)

Bug Fixes

  • autocomplete: Handle error when no argument is given to autocomplete helper (#4) (fee73ab)
  • Fix fish's autorun file path (#15) (fba79bb), closes #15
  • Fix options parsing when only short name is defined (#32) (4b5f754), closes #32
  • Fix typo in README (#17) (f786ef5), closes #17
  • help: Fix help command not exiting (#37) (3c725f6), closes #37
  • logger: Fix logger new line character after metadata (#31) (51139ad), closes #31
  • options: Fix handling of --no-color option (#24) (0ac0619), closes #24
  • parsing: Fixes negative numbers parsing as argument (#16) (690b46d), closes #16 #13
  • program: Force exiting for help command and -h, -V, --version options (#27) (c2e7146)

Features

  • actions: Implement async actions (afef8b2)

0.3.0 (2017-02-26)

Bug Fixes

  • _getLongOptions should only return options that have long notations (d76e3dd)
  • change the way we handle new lines in logger (635fa9b)

Features

  • Node.js 4.4.5+ compatibility (fd0fbdc)

0.2.0 (2017-02-25)

Features

  • Implement auto-completion (#1) (333c968)

0.1.0 (2017-02-19)

Bug Fixes

  • fix eslint errors (84177db)
  • Fix passing logger in action callback (6d35d5f)
  • fix release script (20015a3)

0.1.0-alpha (2017-02-19)

Bug Fixes