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
4
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.10.1 to 0.10.2

132

index.js

@@ -507,7 +507,7 @@ var __create = Object.create;

case "command_help": {
const command2 = event.command;
const commandName = getCommandNameWithParents(command2);
const command3 = event.command;
const commandName = getCommandNameWithParents(command3);
const cliName = event.name;
const desc = command2.desc ?? command2.shortDesc;
const subs = command2.subcommands?.filter((s) => !s.hidden);
const desc = command3.desc ?? command3.shortDesc;
const subs = command3.subcommands?.filter((s) => !s.hidden);
const subcommands = subs && subs.length ? subs : void 0;

@@ -518,3 +518,3 @@ if (desc !== void 0) {

}
const opts = Object.values(command2.options ?? {}).filter(
const opts = Object.values(command3.options ?? {}).filter(
(opt) => !opt.config.isHidden

@@ -525,3 +525,3 @@ );

console.log("\nUsage:");
if (command2.handler) {
if (command3.handler) {
console.log(

@@ -531,6 +531,6 @@ ` ${cliName ? cliName + " " : ""}${commandName}${positionals.length ? " " + positionals.map(({ config: p }) => getOptionTypeText(p)).join(" ") : ""} [flags]`

} else console.log(` ${cliName ? cliName + " " : ""}${commandName} [command]`);
if (command2.aliases) {
if (command3.aliases) {
console.log(`
Aliases:`);
console.log(` ${[command2.name, ...command2.aliases].join(", ")}`);
console.log(` ${[command3.name, ...command3.aliases].join(", ")}`);
}

@@ -613,4 +613,4 @@ if (subcommands) {

const data = commands.map(
(\u0441) => ` ${\u0441.name.padEnd(paddedLength)}${(() => {
const desc2 = \u0441.shortDesc ?? \u0441.desc;
(c) => ` ${c.name.padEnd(paddedLength)}${(() => {
const desc2 = c.shortDesc ?? c.desc;
if (!desc2?.length) return "";

@@ -706,4 +706,4 @@ const split = desc2.split("\n");

case "missing_args_error": {
const missingOpts = event.missing;
msg = `Command '${command.name}' is missing following required options: ${missingOpts.map((opt) => {
const { missing: missingOpts, command: command3 } = event;
msg = `Command '${command3.name}' is missing following required options: ${missingOpts.map((opt) => {
const name = opt.shift();

@@ -717,4 +717,4 @@ const aliases = opt;

case "unrecognized_args_error": {
const { command: command2, unrecognized } = event;
msg = `Unrecognized options for command '${command2.name}': ${unrecognized.join(", ")}`;
const { command: command3, unrecognized } = event;
msg = `Unrecognized options for command '${command3.name}': ${unrecognized.join(", ")}`;
break;

@@ -814,6 +814,6 @@ }

});
var command = (command2) => {
const allNames = command2.aliases ? [command2.name, ...command2.aliases] : [command2.name];
const cmd = (0, import_clone.default)(command2);
if (command2.subcommands && command2.options && Object.values(command2.options).find((opt) => opt._.config.type === "positional")) {
var command2 = (command3) => {
const allNames = command3.aliases ? [command3.name, ...command3.aliases] : [command3.name];
const cmd = (0, import_clone.default)(command3);
if (command3.subcommands && command3.options && Object.values(command3.options).find((opt) => opt._.config.type === "positional")) {
throw new BroCliError(

@@ -823,3 +823,3 @@ `Can't define command '${cmd.name}' - command can't have subcommands and positional args at the same time!`

}
if (!command2.handler && !command2.subcommands) {
if (!command3.handler && !command3.subcommands) {
throw new BroCliError(

@@ -829,3 +829,3 @@ `Can't define command '${cmd.name}' - command without subcommands must have a handler present!`

}
const processedOptions = command2.options ? validateOptions(command2.options) : void 0;
const processedOptions = command3.options ? validateOptions(command3.options) : void 0;
cmd.options = processedOptions;

@@ -865,3 +865,3 @@ cmd.name = cmd.name ?? cmd.aliases?.shift();

const { data: arg, originalIndex: index } = candidates.shift();
const command2 = commands.find((c) => {
const command3 = commands.find((c) => {
const names = c.aliases ? [c.name, ...c.aliases] : [c.name];

@@ -871,5 +871,5 @@ const res = names.find((name) => name === arg);

});
if (!command2) {
if (!command3) {
return {
command: command2,
command: command3,
args

@@ -879,5 +879,5 @@ };

const newArgs = removeByIndex(args, index);
if (!candidates.length || !command2.subcommands) {
if (!candidates.length || !command3.subcommands) {
return {
command: command2,
command: command3,
args: newArgs

@@ -887,3 +887,3 @@ };

const newCandidates = candidates.map((c) => ({ data: c.data, originalIndex: c.originalIndex - 1 }));
const subcommand = getCommandInner(command2.subcommands, newCandidates, newArgs, cliName, cliDescription);
const subcommand = getCommandInner(command3.subcommands, newCandidates, newArgs, cliName, cliDescription);
if (!subcommand.command) {

@@ -895,3 +895,3 @@ throw new BroCliError(void 0, {

description: cliDescription,
command: command2,
command: command3,
offender: candidates[0].data

@@ -933,4 +933,4 @@ });

}
const { command: command2, args: argsRes } = getCommandInner(commands, candidates, args, cliName, cliDescription);
if (!command2) {
const { command: command3, args: argsRes } = getCommandInner(commands, candidates, args, cliName, cliDescription);
if (!command3) {
throw new BroCliError(void 0, {

@@ -946,7 +946,7 @@ type: "error",

return {
command: command2,
command: command3,
args: argsRes
};
};
var parseArg = (command2, options, positionals, arg, nextArg, cliName, cliDescription) => {
var parseArg = (command3, options, positionals, arg, nextArg, cliName, cliDescription) => {
let data = void 0;

@@ -977,3 +977,3 @@ const argSplit = arg.split("=");

violation: "enum_violation",
command: command2,
command: command3,
option: pos[1],

@@ -1023,3 +1023,3 @@ offender: {

option: opt,
command: command2,
command: command3,
offender: {

@@ -1041,3 +1041,3 @@ namePart,

option: opt,
command: command2,
command: command3,
offender: {

@@ -1056,3 +1056,3 @@ namePart,

option: opt,
command: command2,
command: command3,
offender: {

@@ -1074,3 +1074,3 @@ namePart,

option: opt,
command: command2,
command: command3,
offender: {

@@ -1090,3 +1090,3 @@ namePart,

option: opt,
command: command2,
command: command3,
offender: {

@@ -1105,3 +1105,3 @@ namePart,

option: opt,
command: command2,
command: command3,
offender: {

@@ -1120,3 +1120,3 @@ namePart,

option: opt,
command: command2,
command: command3,
offender: {

@@ -1135,3 +1135,3 @@ namePart,

option: opt,
command: command2,
command: command3,
offender: {

@@ -1154,4 +1154,4 @@ namePart,

};
var parseOptions = (command2, args, cliName, cliDescription, omitKeysOfUndefinedOptions) => {
const options = command2.options;
var parseOptions = (command3, args, cliName, cliDescription, omitKeysOfUndefinedOptions) => {
const options = command3.options;
const optEntries = Object.entries(options ?? {}).map(

@@ -1175,3 +1175,3 @@ (opt) => [opt[0], opt[1].config]

isVersion
} = parseArg(command2, nonPositionalEntries, positionalEntries, arg, nextArg, cliName, cliDescription);
} = parseArg(command3, nonPositionalEntries, positionalEntries, arg, nextArg, cliName, cliDescription);
if (!option) unrecognizedArgsArr.push(arg.split("=")[0]);

@@ -1198,3 +1198,3 @@ if (skipNext) ++i;

description: cliDescription,
command: command2,
command: command3,
missing: missingRequiredArr

@@ -1209,3 +1209,3 @@ });

description: cliDescription,
command: command2,
command: command3,
unrecognized: unrecognizedArgsArr

@@ -1216,3 +1216,3 @@ });

};
var getCommandNameWithParents = (command2) => command2.parent ? `${getCommandNameWithParents(command2.parent)} ${command2.name}` : command2.name;
var getCommandNameWithParents = (command3) => command3.parent ? `${getCommandNameWithParents(command3.parent)} ${command3.name}` : command3.name;
var validateCommands = (commands, parent) => {

@@ -1267,9 +1267,9 @@ const storedNames = {};

if (helpIndex !== -1 && (helpIndex > 0 ? args[helpIndex - 1]?.startsWith("-") && !args[helpIndex - 1].includes("=") ? false : true : true)) {
const command3 = getCommand(processedCmds, args, cliName, cliDescription).command;
if (typeof command3 === "object") {
return command3.help !== void 0 ? await executeOrLog(command3.help) : await eventHandler({
const command4 = getCommand(processedCmds, args, cliName, cliDescription).command;
if (typeof command4 === "object") {
return command4.help !== void 0 ? await executeOrLog(command4.help) : await eventHandler({
type: "command_help",
description: cliDescription,
name: cliName,
command: command3
command: command4
});

@@ -1293,4 +1293,4 @@ } else {

}
const { command: command2, args: newArgs } = getCommand(processedCmds, args, cliName, cliDescription);
if (!command2) {
const { command: command3, args: newArgs } = getCommand(processedCmds, args, cliName, cliDescription);
if (!command3) {
return help !== void 0 ? await executeOrLog(help) : await eventHandler({

@@ -1303,3 +1303,3 @@ type: "global_help",

}
if (command2 === "help") {
if (command3 === "help") {
let helpCommand;

@@ -1324,9 +1324,9 @@ let newestArgs = newArgs;

}
const optionResult = parseOptions(command2, newArgs, cliName, cliDescription, omitKeysOfUndefinedOptions);
const optionResult = parseOptions(command3, newArgs, cliName, cliDescription, omitKeysOfUndefinedOptions);
if (optionResult === "help") {
return command2.help !== void 0 ? await executeOrLog(command2.help) : await eventHandler({
return command3.help !== void 0 ? await executeOrLog(command3.help) : await eventHandler({
type: "command_help",
description: cliDescription,
name: cliName,
command: command2
command: command3
});

@@ -1341,13 +1341,13 @@ }

}
if (command2.handler) {
if (config?.hook) await config.hook("before", command2);
await command2.handler(command2.transform ? await command2.transform(optionResult) : optionResult);
if (config?.hook) await config.hook("after", command2);
if (command3.handler) {
if (config?.hook) await config.hook("before", command3);
await command3.handler(command3.transform ? await command3.transform(optionResult) : optionResult);
if (config?.hook) await config.hook("after", command3);
return;
} else {
return command2.help !== void 0 ? await executeOrLog(command2.help) : await eventHandler({
return command3.help !== void 0 ? await executeOrLog(command3.help) : await eventHandler({
type: "command_help",
description: cliDescription,
name: cliName,
command: command2
command: command3
});

@@ -1376,6 +1376,6 @@ }

var handler = (options, handler2) => handler2;
var test = async (command2, args) => {
var test = async (command3, args) => {
try {
const cliParsedArgs = shellArgs(args);
const options = parseOptions(command2, cliParsedArgs, void 0, void 0);
const options = parseOptions(command3, cliParsedArgs, void 0, void 0);
if (options === "help" || options === "version") {

@@ -1387,3 +1387,3 @@ return {

return {
options: command2.transform ? await command2.transform(options) : options,
options: command3.transform ? await command3.transform(options) : options,
type: "handler"

@@ -1513,3 +1513,3 @@ };

boolean,
command,
command2 as command,
commandsInfo,

@@ -1516,0 +1516,0 @@ getCommandNameWithParents,

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

"author": "Drizzle Team",
"version": "0.10.1",
"version": "0.10.2",
"description": "Modern type-safe way of building CLIs",

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

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