New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@drizzle-team/brocli

Package Overview
Dependencies
Maintainers
0
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@drizzle-team/brocli - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

13

index.js

@@ -21,3 +21,3 @@ // src/brocli-error.ts

console.log(
"To read the details about any particular command type: help [commandName] | help --command=<commandName> | help -c <comandName>"
"To read the details about any particular command type: [commandName] --help"
);

@@ -239,2 +239,8 @@ } else {

}
const lCaseName = n?.toLowerCase();
if (lCaseName === "0" || lCaseName === "1" || lCaseName === "true" || lCaseName === "false") {
throw new BroCliError(
`Can't define command '${cmd.name}' - '${n}' is a reserved for boolean values name!`
);
}
const idx = allNames.findIndex((an) => an === n);

@@ -274,2 +280,7 @@ if (idx !== i) throw new BroCliError(`Can't define command '${cmd.name}' - duplicate alias '${n}'!`);

const arg = args[i];
if (arg === "--help" || arg === "-h" || arg === "--version" || arg === "-v") {
const lCaseNext = args[i + 1]?.toLowerCase();
if (lCaseNext === "0" || lCaseNext === "1" || lCaseNext === "true" || lCaseNext === "false") ++i;
continue;
}
if (arg?.startsWith("-")) {

@@ -276,0 +287,0 @@ if (!arg.includes("=")) ++i;

2

package.json

@@ -5,3 +5,3 @@ {

"author": "Drizzle Team",
"version": "0.5.1",
"version": "0.5.2",
"description": "Typed CLI command runner",

@@ -8,0 +8,0 @@ "license": "Apache-2.0",

@@ -133,6 +133,2 @@ # BroCLI

const commandHandler = (options: TypeOf<typeof commandOptions>) => {
// Your logic goes here...
}
const commands: Command[] = []

@@ -146,4 +142,15 @@

options: commandOptions,
handler: commandHandler,
help: () => 'This command works like this: ...'
transform: (options) => {
// Preprocess options here...
return processedOptions
},
handler: (processedOptions) => {
// Your logic goes here...
},
help: () => 'This command works like this: ...',
subcommands: [
command(
// You can define subcommands like this
)
]
}));

@@ -155,6 +162,6 @@ ```

- `name` - name by which command is searched in cli args
:warning: - must not start with `-` character and be unique per command collection
:warning: - must not start with `-` character, be equal to [`true`, `false`, `0`, `1`] (case-insensitive) and be unique per command collection
- `aliases` - aliases by which command is searched in cli args
:warning: - must not start with `-` character and be unique per command collection
:warning: - must not start with `-` character, be equal to [`true`, `false`, `0`, `1`] (case-insensitive) and be unique per command collection

@@ -167,2 +174,5 @@ - `description` - description for command to be displayed in `help` command

- `transform` - optional function to preprocess options before they are passed to handler
:warning: - type of return mutates type of handler's input
- `handler` - function, which will be executed in case of successful option parse

@@ -172,2 +182,5 @@

- `subcommands` - subcommands for command
:warning: - command can't have subcommands and `positional` options at the same time
### Running commands

@@ -219,3 +232,3 @@

In `BroCLI`, command doesn't have to be the first argument, instead it may be contained in any order.
To make this possible, hovewer, option that's stated right before command should have an explicit value, even if it is a flag: `--verbose true <command-name>`
To make this possible, hovewer, option that's stated right before command should have an explicit value, even if it is a flag: `--verbose true <command-name>` (does not apply to reserved flags: [ `--help` | `-h` | `--version` | `-v`])
Options are parsed in strict mode, meaning that having any unrecognized options will result in an error.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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