Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

command-line-interface

Package Overview
Dependencies
Maintainers
5
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

command-line-interface - npm Package Compare versions

Comparing version 4.0.24 to 5.0.0

build/lib/validateOnlyLeafCommandsHaveDefaultOptions.d.ts

4

build/lib/runCli.js

@@ -8,2 +8,3 @@ "use strict";

const runCliRecursive_1 = require("./runCliRecursive");
const validateOnlyLeafCommandsHaveDefaultOptions_1 = require("./validateOnlyLeafCommandsHaveDefaultOptions");
const runCli = async function ({ rootCommand, argv, handlers = {} }) {

@@ -33,2 +34,5 @@ const handlersWithDefaults = {

};
(0, validateOnlyLeafCommandsHaveDefaultOptions_1.validateOnlyLeafCommandsHaveDefaultOptions)({
command: rootCommand
});
const extendedRootCommand = (0, addHelpCommandToCli_1.addHelpCommandToCli)({ rootCommand });

@@ -35,0 +39,0 @@ const recommendCommand = (0, getRecommendCommand_1.getRecommendCommand)({ rootCommand: extendedRootCommand });

@@ -0,1 +1,15 @@

# [5.0.0](https://github.com/thenativeweb/command-line-interface/compare/4.0.24...5.0.0) (2022-09-08)
### Bug Fixes
* Only allow default options in leaf commands. ([#449](https://github.com/thenativeweb/command-line-interface/issues/449)) ([06c2c43](https://github.com/thenativeweb/command-line-interface/commit/06c2c437c7b7a4b02392baad0c67a9fad1e6c86f))
### BREAKING CHANGES
* Commands with sub-commands can not define default options anymore.
* chore: Mention the new limitation in the readme.
## [4.0.24](https://github.com/thenativeweb/command-line-interface/compare/4.0.23...4.0.24) (2022-08-24)

@@ -2,0 +16,0 @@

@@ -7,2 +7,3 @@ import { addHelpCommandToCli } from './addHelpCommandToCli';

import { runCliRecursive } from './runCliRecursive';
import { validateOnlyLeafCommandsHaveDefaultOptions } from './validateOnlyLeafCommandsHaveDefaultOptions';

@@ -38,2 +39,6 @@ const runCli = async function ({ rootCommand, argv, handlers = {}}: {

validateOnlyLeafCommandsHaveDefaultOptions({
command: rootCommand
});
const extendedRootCommand = addHelpCommandToCli({ rootCommand });

@@ -40,0 +45,0 @@

4

package.json
{
"name": "command-line-interface",
"version": "4.0.24",
"version": "5.0.0",
"description": "command-line-interface is a foundation for CLI applications.",

@@ -34,3 +34,3 @@ "contributors": [

"command-line-usage": "6.1.3",
"defekt": "9.3.0",
"defekt": "9.3.1",
"string-similarity": "4.0.4",

@@ -37,0 +37,0 @@ "strip-indent": "3.0.0"

@@ -140,2 +140,4 @@ # command-line-interface

*Note that only commands that don't have sub-commands can have a `defaultOption`. This limitation exists, because default options might otherwise conflict with sub-commands.*
Last but not least, you may specify a `validate` function for an option definition. Inside this function you are free to do whatever you need to do to ensure that the option's given value is valid. However, if you throw an exception from within this function, command-line-interface aborts the command's execution, and shows an error message:

@@ -142,0 +144,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc