drizzle-kit 0.24.0-6205f01 → 0.24.0-6386ea9
Sign up to get free protection for your applications and to get access to all the features.
- package/bin.cjs +598 -213
- package/package.json +3 -3
package/bin.cjs
CHANGED
@@ -80519,7 +80519,7 @@ var init_studio2 = __esm({
|
|
80519
80519
|
}
|
80520
80520
|
});
|
80521
80521
|
|
80522
|
-
// ../node_modules/.pnpm/@drizzle-team+brocli@0.
|
80522
|
+
// ../node_modules/.pnpm/@drizzle-team+brocli@0.10.1/node_modules/@drizzle-team/brocli/index.js
|
80523
80523
|
var __create2 = Object.create;
|
80524
80524
|
var __defProp2 = Object.defineProperty;
|
80525
80525
|
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
@@ -80966,130 +80966,299 @@ var require_shell_quote = __commonJS2({
|
|
80966
80966
|
}
|
80967
80967
|
});
|
80968
80968
|
var BroCliError = class extends Error {
|
80969
|
-
constructor(message) {
|
80969
|
+
constructor(message, event) {
|
80970
80970
|
const errPrefix = "BroCli error: ";
|
80971
80971
|
super(message === void 0 ? message : `${errPrefix}${message}`);
|
80972
|
+
this.event = event;
|
80972
80973
|
}
|
80973
80974
|
};
|
80974
80975
|
var import_clone = __toESM2(require_clone(), 1);
|
80975
|
-
var
|
80976
|
-
|
80977
|
-
|
80978
|
-
|
80979
|
-
|
80980
|
-
|
80981
|
-
|
80982
|
-
|
80983
|
-
|
80984
|
-
|
80985
|
-
|
80986
|
-
|
80987
|
-
|
80988
|
-
|
80989
|
-
|
80990
|
-
|
80991
|
-
|
80992
|
-
|
80993
|
-
|
80994
|
-
|
80995
|
-
|
80996
|
-
|
80997
|
-
|
80998
|
-
|
80999
|
-
|
81000
|
-
}
|
81001
|
-
|
81002
|
-
|
81003
|
-
|
81004
|
-
|
81005
|
-
|
81006
|
-
|
81007
|
-
|
81008
|
-
|
80976
|
+
var getOptionTypeText = (option) => {
|
80977
|
+
let result = "";
|
80978
|
+
switch (option.type) {
|
80979
|
+
case "boolean":
|
80980
|
+
result = "";
|
80981
|
+
break;
|
80982
|
+
case "number": {
|
80983
|
+
if ((option.minVal ?? option.maxVal) !== void 0) {
|
80984
|
+
let text = "";
|
80985
|
+
if (option.isInt)
|
80986
|
+
text = text + `integer `;
|
80987
|
+
if (option.minVal !== void 0)
|
80988
|
+
text = text + `[${option.minVal};`;
|
80989
|
+
else
|
80990
|
+
text = text + `(\u221E;`;
|
80991
|
+
if (option.maxVal !== void 0)
|
80992
|
+
text = text + `${option.maxVal}]`;
|
80993
|
+
else
|
80994
|
+
text = text + `\u221E)`;
|
80995
|
+
result = text;
|
80996
|
+
break;
|
80997
|
+
}
|
80998
|
+
if (option.isInt) {
|
80999
|
+
result = "integer";
|
81000
|
+
break;
|
81001
|
+
}
|
81002
|
+
result = "number";
|
81003
|
+
break;
|
81004
|
+
}
|
81005
|
+
case "string": {
|
81006
|
+
if (option.enumVals) {
|
81007
|
+
result = "[ " + option.enumVals.join(" | ") + " ]";
|
81008
|
+
break;
|
81009
|
+
}
|
81010
|
+
result = "string";
|
81011
|
+
break;
|
81012
|
+
}
|
81013
|
+
case "positional": {
|
81014
|
+
result = `${option.isRequired ? "<" : "["}${option.enumVals ? option.enumVals.join("|") : option.name}${option.isRequired ? ">" : "]"}`;
|
81015
|
+
break;
|
81016
|
+
}
|
81017
|
+
}
|
81018
|
+
if (option.isRequired && option.type !== "positional")
|
81019
|
+
result = "!" + result.length ? " " : "" + result;
|
81020
|
+
return result;
|
81021
|
+
};
|
81022
|
+
var defaultEventHandler = async (event) => {
|
81023
|
+
var _a;
|
81024
|
+
switch (event.type) {
|
81025
|
+
case "command_help": {
|
81026
|
+
const command2 = event.command;
|
81027
|
+
const commandName = getCommandNameWithParents(command2);
|
81028
|
+
const cliName = event.name;
|
81029
|
+
const desc = command2.desc ?? command2.shortDesc;
|
81030
|
+
const subs = (_a = command2.subcommands) == null ? void 0 : _a.filter((s2) => !s2.hidden);
|
81031
|
+
const subcommands = subs && subs.length ? subs : void 0;
|
81032
|
+
if (desc !== void 0) {
|
81033
|
+
console.log(`
|
81034
|
+
${desc}`);
|
81035
|
+
}
|
81036
|
+
const opts = Object.values(command2.options ?? {}).filter(
|
81037
|
+
(opt) => !opt.config.isHidden
|
81038
|
+
);
|
81039
|
+
const positionals = opts.filter((opt) => opt.config.type === "positional");
|
81040
|
+
const options = opts.filter((opt) => opt.config.type !== "positional");
|
81041
|
+
console.log("\nUsage:");
|
81042
|
+
if (command2.handler) {
|
81043
|
+
console.log(
|
81044
|
+
` ${cliName ? cliName + " " : ""}${commandName}${positionals.length ? " " + positionals.map(({ config: p2 }) => getOptionTypeText(p2)).join(" ") : ""} [flags]`
|
81045
|
+
);
|
81046
|
+
} else
|
81047
|
+
console.log(` ${cliName ? cliName + " " : ""}${commandName} [command]`);
|
81048
|
+
if (command2.aliases) {
|
81049
|
+
console.log(`
|
81050
|
+
Aliases:`);
|
81051
|
+
console.log(` ${[command2.name, ...command2.aliases].join(", ")}`);
|
81052
|
+
}
|
81053
|
+
if (subcommands) {
|
81054
|
+
console.log("\nAvailable Commands:");
|
81055
|
+
const padding = 3;
|
81056
|
+
const maxLength = subcommands.reduce((p2, e2) => e2.name.length > p2 ? e2.name.length : p2, 0);
|
81057
|
+
const paddedLength = maxLength + padding;
|
81058
|
+
const preDescPad = 2 + paddedLength;
|
81059
|
+
const data = subcommands.map(
|
81060
|
+
(s2) => ` ${s2.name.padEnd(paddedLength)}${(() => {
|
81061
|
+
const description = s2.shortDesc ?? s2.desc;
|
81062
|
+
if (!(description == null ? void 0 : description.length))
|
81063
|
+
return "";
|
81064
|
+
const split = description.split("\n");
|
81065
|
+
const first = split.shift();
|
81066
|
+
const final = [first, ...split.map((s22) => "".padEnd(preDescPad) + s22)].join("\n");
|
81067
|
+
return final;
|
81068
|
+
})()}`
|
81069
|
+
).join("\n");
|
81070
|
+
console.log(data);
|
81071
|
+
}
|
81072
|
+
if (options.length) {
|
81073
|
+
const aliasLength = options.reduce((p2, e2) => {
|
81074
|
+
const currentLength = e2.config.aliases.reduce((pa, a) => pa + a.length, 0) + (e2.config.aliases.length - 1) * 2 + 1;
|
81075
|
+
return currentLength > p2 ? currentLength : p2;
|
81076
|
+
}, 0);
|
81077
|
+
const paddedAliasLength = aliasLength > 0 ? aliasLength + 1 : 0;
|
81078
|
+
const nameLength = options.reduce((p2, e2) => {
|
81079
|
+
const typeLen = getOptionTypeText(e2.config).length;
|
81080
|
+
const length = typeLen > 0 ? e2.config.name.length + 1 + typeLen : e2.config.name.length;
|
81081
|
+
return length > p2 ? length : p2;
|
81082
|
+
}, 0) + 3;
|
81083
|
+
const preDescPad = paddedAliasLength + nameLength + 2;
|
81084
|
+
const data = options.map(
|
81085
|
+
({ config: opt }) => ` ${`${opt.aliases.length ? opt.aliases.join(", ") + "," : ""}`.padEnd(paddedAliasLength)}${`${opt.name}${(() => {
|
81086
|
+
const typeText = getOptionTypeText(opt);
|
81087
|
+
return typeText.length ? " " + typeText : "";
|
81088
|
+
})()}`.padEnd(nameLength)}${(() => {
|
81089
|
+
var _a2;
|
81090
|
+
if (!((_a2 = opt.description) == null ? void 0 : _a2.length)) {
|
81091
|
+
return opt.default !== void 0 ? `default: ${JSON.stringify(opt.default)}` : "";
|
81092
|
+
}
|
81093
|
+
const split = opt.description.split("\n");
|
81094
|
+
const first = split.shift();
|
81095
|
+
const def = opt.default !== void 0 ? ` (default: ${JSON.stringify(opt.default)})` : "";
|
81096
|
+
const final = [first, ...split.map((s2) => "".padEnd(preDescPad) + s2)].join("\n") + def;
|
81097
|
+
return final;
|
81098
|
+
})()}`
|
81099
|
+
).join("\n");
|
81100
|
+
console.log("\nFlags:");
|
81101
|
+
console.log(data);
|
81102
|
+
}
|
81103
|
+
console.log("\nGlobal flags:");
|
81104
|
+
console.log(` -h, --help help for ${commandName}`);
|
81105
|
+
console.log(` -v, --version version${cliName ? ` for ${cliName}` : ""}`);
|
81106
|
+
if (subcommands) {
|
81107
|
+
console.log(
|
81108
|
+
`
|
81109
|
+
Use "${cliName ? cliName + " " : ""}${commandName} [command] --help" for more information about a command.
|
81110
|
+
`
|
81111
|
+
);
|
81112
|
+
}
|
81113
|
+
return true;
|
81114
|
+
}
|
81115
|
+
case "global_help": {
|
81116
|
+
const cliName = event.name;
|
81117
|
+
const desc = event.description;
|
81118
|
+
const commands = event.commands.filter((c) => !c.hidden);
|
81119
|
+
if (desc !== void 0) {
|
81120
|
+
console.log(`${desc}
|
81121
|
+
`);
|
81122
|
+
}
|
81123
|
+
console.log("Usage:");
|
81124
|
+
console.log(` ${cliName ? cliName + " " : ""}[command]`);
|
81125
|
+
if (commands.length) {
|
81126
|
+
console.log("\nAvailable Commands:");
|
81127
|
+
const padding = 3;
|
81128
|
+
const maxLength = commands.reduce((p2, e2) => e2.name.length > p2 ? e2.name.length : p2, 0);
|
81129
|
+
const paddedLength = maxLength + padding;
|
81130
|
+
const data = commands.map(
|
81131
|
+
(\u0441) => ` ${\u0441.name.padEnd(paddedLength)}${(() => {
|
81132
|
+
const desc2 = \u0441.shortDesc ?? \u0441.desc;
|
81133
|
+
if (!(desc2 == null ? void 0 : desc2.length))
|
81134
|
+
return "";
|
81135
|
+
const split = desc2.split("\n");
|
81136
|
+
const first = split.shift();
|
81137
|
+
const final = [first, ...split.map((s2) => "".padEnd(paddedLength + 2) + s2)].join("\n");
|
81138
|
+
return final;
|
81139
|
+
})()}`
|
81140
|
+
).join("\n");
|
81141
|
+
console.log(data);
|
81142
|
+
} else {
|
81143
|
+
console.log("\nNo available commands.");
|
81144
|
+
}
|
81145
|
+
console.log("\nFlags:");
|
81146
|
+
console.log(` -h, --help help${cliName ? ` for ${cliName}` : ""}`);
|
81147
|
+
console.log(` -v, --version version${cliName ? ` for ${cliName}` : ""}`);
|
81148
|
+
console.log("\n");
|
81149
|
+
return true;
|
81150
|
+
}
|
81151
|
+
case "version": {
|
81152
|
+
return true;
|
81153
|
+
}
|
81154
|
+
case "error": {
|
81155
|
+
let msg;
|
81156
|
+
switch (event.violation) {
|
81157
|
+
case "above_max": {
|
81158
|
+
const matchedName = event.offender.namePart;
|
81159
|
+
const data = event.offender.dataPart;
|
81160
|
+
const option = event.option;
|
81161
|
+
const max = option.maxVal;
|
81162
|
+
msg = `Invalid value: number type argument '${matchedName}' expects maximal value of ${max} as an input, got: ${data}`;
|
81163
|
+
break;
|
81164
|
+
}
|
81165
|
+
case "below_min": {
|
81166
|
+
const matchedName = event.offender.namePart;
|
81167
|
+
const data = event.offender.dataPart;
|
81168
|
+
const option = event.option;
|
81169
|
+
const min = option.minVal;
|
81170
|
+
msg = `Invalid value: number type argument '${matchedName}' expects minimal value of ${min} as an input, got: ${data}`;
|
81171
|
+
break;
|
81172
|
+
}
|
81173
|
+
case "expected_int": {
|
81174
|
+
const matchedName = event.offender.namePart;
|
81175
|
+
const data = event.offender.dataPart;
|
81176
|
+
msg = `Invalid value: number type argument '${matchedName}' expects an integer as an input, got: ${data}`;
|
81177
|
+
break;
|
81178
|
+
}
|
81179
|
+
case "invalid_boolean_syntax": {
|
81180
|
+
const matchedName = event.offender.namePart;
|
81181
|
+
const data = event.offender.dataPart;
|
81182
|
+
msg = `Invalid syntax: boolean type argument '${matchedName}' must have it's value passed in the following formats: ${matchedName}=<value> | ${matchedName} <value> | ${matchedName}.
|
81183
|
+
Allowed values: true, false, 0, 1`;
|
81184
|
+
break;
|
81185
|
+
}
|
81186
|
+
case "invalid_string_syntax": {
|
81187
|
+
const matchedName = event.offender.namePart;
|
81188
|
+
msg = `Invalid syntax: string type argument '${matchedName}' must have it's value passed in the following formats: ${matchedName}=<value> | ${matchedName} <value>`;
|
81189
|
+
break;
|
81190
|
+
}
|
81191
|
+
case "invalid_number_syntax": {
|
81192
|
+
const matchedName = event.offender.namePart;
|
81193
|
+
msg = `Invalid syntax: number type argument '${matchedName}' must have it's value passed in the following formats: ${matchedName}=<value> | ${matchedName} <value>`;
|
81194
|
+
break;
|
81195
|
+
}
|
81196
|
+
case "invalid_number_value": {
|
81197
|
+
const matchedName = event.offender.namePart;
|
81198
|
+
const data = event.offender.dataPart;
|
81199
|
+
msg = `Invalid value: number type argument '${matchedName}' expects a number as an input, got: ${data}`;
|
81200
|
+
break;
|
81201
|
+
}
|
81202
|
+
case "enum_violation": {
|
81203
|
+
const matchedName = event.offender.namePart;
|
81204
|
+
const data = event.offender.dataPart;
|
81205
|
+
const option = event.option;
|
81206
|
+
const values = option.enumVals;
|
81207
|
+
msg = option.type === "positional" ? `Invalid value: value for the positional argument '${option.name}' must be either one of the following: ${values.join(", ")}; Received: ${data}` : `Invalid value: value for the argument '${matchedName}' must be either one of the following: ${values.join(", ")}; Received: ${data}`;
|
81208
|
+
break;
|
81209
|
+
}
|
81210
|
+
case "unknown_command_error": {
|
81211
|
+
const msg2 = `Unknown command: '${event.offender}'.
|
81212
|
+
Type '--help' to get help on the cli.`;
|
81213
|
+
console.error(msg2);
|
81214
|
+
return true;
|
81215
|
+
}
|
81216
|
+
case "unknown_subcommand_error": {
|
81217
|
+
const cName = getCommandNameWithParents(event.command);
|
81218
|
+
const msg2 = `Unknown command: ${cName} ${event.offender}.
|
81219
|
+
Type '${cName} --help' to get the help on command.`;
|
81220
|
+
console.error(msg2);
|
81221
|
+
return true;
|
81222
|
+
}
|
81223
|
+
case "missing_args_error": {
|
81224
|
+
const missingOpts = event.missing;
|
81225
|
+
msg = `Command '${command.name}' is missing following required options: ${missingOpts.map((opt) => {
|
81226
|
+
const name = opt.shift();
|
81227
|
+
const aliases = opt;
|
81228
|
+
if (aliases.length)
|
81229
|
+
return `${name} [${aliases.join(", ")}]`;
|
81230
|
+
return name;
|
81231
|
+
}).join(", ")}`;
|
81232
|
+
break;
|
81233
|
+
}
|
81234
|
+
case "unrecognized_args_error": {
|
81235
|
+
const { command: command2, unrecognized } = event;
|
81236
|
+
msg = `Unrecognized options for command '${command2.name}': ${unrecognized.join(", ")}`;
|
81237
|
+
break;
|
81238
|
+
}
|
81239
|
+
case "unknown_error": {
|
81240
|
+
const e2 = event.error;
|
81241
|
+
console.error(typeof e2 === "object" && e2 !== null && "message" in e2 ? e2.message : e2);
|
81242
|
+
return true;
|
81243
|
+
}
|
81244
|
+
}
|
81245
|
+
console.error(msg);
|
81246
|
+
return true;
|
81247
|
+
}
|
81009
81248
|
}
|
81249
|
+
return false;
|
81010
81250
|
};
|
81251
|
+
var eventHandlerWrapper = (customEventHandler) => async (event) => await customEventHandler(event) ? true : await defaultEventHandler(event);
|
81252
|
+
var import_shell_quote = __toESM2(require_shell_quote(), 1);
|
81011
81253
|
function isInt(value) {
|
81012
81254
|
return value === Math.floor(value);
|
81013
81255
|
}
|
81014
|
-
var
|
81015
|
-
const msg = `Unknown command: '${caller}'.
|
81016
|
-
Type '--help' to get help on the cli.`;
|
81017
|
-
return new Error(msg);
|
81018
|
-
};
|
81019
|
-
var unknownSubcommand = (command2, caller) => {
|
81020
|
-
const name = getCommandNameRecursive(command2);
|
81021
|
-
const msg = `Unknown command: ${name} ${caller}.
|
81022
|
-
Type '${name} --help' to get the help on command.`;
|
81023
|
-
new Error(
|
81024
|
-
msg
|
81025
|
-
);
|
81026
|
-
return new Error(msg);
|
81027
|
-
};
|
81028
|
-
var missingRequired = (command2, missingOpts) => {
|
81029
|
-
const msg = `Command '${command2.name}' is missing following required options: ${missingOpts.map((opt) => {
|
81030
|
-
const name = opt.shift();
|
81031
|
-
const aliases = opt;
|
81032
|
-
if (aliases.length)
|
81033
|
-
return `${name} [${aliases.join(", ")}]`;
|
81034
|
-
return name;
|
81035
|
-
}).join(", ")}`;
|
81036
|
-
return new Error(msg);
|
81037
|
-
};
|
81038
|
-
var unrecognizedOptions = (command2, unrecognizedArgs) => {
|
81039
|
-
const msg = `Unrecognized options for command '${command2.name}': ${unrecognizedArgs.join(", ")}`;
|
81040
|
-
return new Error(msg);
|
81041
|
-
};
|
81042
|
-
var invalidBooleanSyntax = (matchedName) => {
|
81043
|
-
return new Error(
|
81044
|
-
`Invalid syntax: boolean type argument '${matchedName}' must have it's value passed in the following formats: ${matchedName}=<value> | ${matchedName} <value> | ${matchedName}.
|
81045
|
-
Allowed values: true, false, 0, 1`
|
81046
|
-
);
|
81047
|
-
};
|
81048
|
-
var invalidStringSyntax = (matchedName) => {
|
81049
|
-
return new Error(
|
81050
|
-
`Invalid syntax: string type argument '${matchedName}' must have it's value passed in the following formats: ${matchedName}=<value> | ${matchedName} <value>`
|
81051
|
-
);
|
81052
|
-
};
|
81053
|
-
var enumViolation = (matchedName, data, values) => {
|
81054
|
-
return new Error(
|
81055
|
-
`Invalid value: value for the argument '${matchedName}' must be either one of the following: ${values.join(", ")}; Received: ${data}`
|
81056
|
-
);
|
81057
|
-
};
|
81058
|
-
var enumViolationPos = (matchedName, data, values) => {
|
81059
|
-
return new Error(
|
81060
|
-
`Invalid value: value for the argument '${matchedName}' must be either one of the following: ${values.join(", ")}; Received: ${data}`
|
81061
|
-
);
|
81062
|
-
};
|
81063
|
-
var invalidNumberSyntax = (matchedName) => {
|
81064
|
-
return new Error(
|
81065
|
-
`Invalid syntax: number type argument '${matchedName}' must have it's value passed in the following formats: ${matchedName}=<value> | ${matchedName} <value>`
|
81066
|
-
);
|
81067
|
-
};
|
81068
|
-
var invalidNumberValue = (matchedName, data) => {
|
81069
|
-
return new Error(
|
81070
|
-
`Invalid value: number type argument '${matchedName}' expects a number as an input, got: ${data}`
|
81071
|
-
);
|
81072
|
-
};
|
81073
|
-
var invalidInteger = (matchedName, data) => {
|
81074
|
-
return new Error(
|
81075
|
-
`Invalid value: number type argument '${matchedName}' expects an integer as an input, got: ${data}`
|
81076
|
-
);
|
81077
|
-
};
|
81078
|
-
var belowMin = (matchedName, data, min) => {
|
81079
|
-
return new Error(
|
81080
|
-
`Invalid value: number type argument '${matchedName}' expects minimal value of ${min} as an input, got: ${data}`
|
81081
|
-
);
|
81082
|
-
};
|
81083
|
-
var aboveMax = (matchedName, data, max) => {
|
81084
|
-
return new Error(
|
81085
|
-
`Invalid value: number type argument '${matchedName}' expects maximal value of ${max} as an input, got: ${data}`
|
81086
|
-
);
|
81087
|
-
};
|
81256
|
+
var executeOrLog = async (target) => typeof target === "string" ? console.log(target) : target ? await target() : void 0;
|
81088
81257
|
var generatePrefix = (name) => name.startsWith("-") ? name : name.length > 1 ? `--${name}` : `-${name}`;
|
81089
81258
|
var validateOptions = (config) => {
|
81090
81259
|
const cloned = (0, import_clone.default)(config);
|
81091
81260
|
const entries = [];
|
81092
|
-
const storedNames =
|
81261
|
+
const storedNames = [];
|
81093
81262
|
const cfgEntries = Object.entries(cloned);
|
81094
81263
|
for (const [key, value] of cfgEntries) {
|
81095
81264
|
const cfg = value._.config;
|
@@ -81099,13 +81268,13 @@ var validateOptions = (config) => {
|
|
81099
81268
|
continue;
|
81100
81269
|
if (cfg.name.includes("=")) {
|
81101
81270
|
throw new BroCliError(
|
81102
|
-
`Can't define option ${cfg.name} - option names and aliases cannot contain '='!`
|
81271
|
+
`Can't define option '${generatePrefix(cfg.name)}' - option names and aliases cannot contain '='!`
|
81103
81272
|
);
|
81104
81273
|
}
|
81105
81274
|
for (const alias of cfg.aliases) {
|
81106
81275
|
if (alias.includes("=")) {
|
81107
81276
|
throw new BroCliError(
|
81108
|
-
`Can't define option ${cfg.name} - option names and aliases cannot contain '='!`
|
81277
|
+
`Can't define option '${generatePrefix(cfg.name)}' - option names and aliases cannot contain '='!`
|
81109
81278
|
);
|
81110
81279
|
}
|
81111
81280
|
}
|
@@ -81123,33 +81292,33 @@ var validateOptions = (config) => {
|
|
81123
81292
|
for (const name of allNames) {
|
81124
81293
|
const match2 = reservedNames.find((n) => n === name);
|
81125
81294
|
if (match2)
|
81126
|
-
throw new BroCliError(`Can't define option ${cfg.name} - name '${match2}' is reserved!`);
|
81295
|
+
throw new BroCliError(`Can't define option '${cfg.name}' - name '${match2}' is reserved!`);
|
81127
81296
|
}
|
81128
|
-
const
|
81129
|
-
for (const storage2 of storageVals) {
|
81297
|
+
for (const storage2 of storedNames) {
|
81130
81298
|
const nameOccupier = storage2.find((e2) => e2 === cfg.name);
|
81131
81299
|
if (!nameOccupier)
|
81132
81300
|
continue;
|
81133
81301
|
throw new BroCliError(
|
81134
|
-
`Can't define option '${cfg.name}'
|
81302
|
+
`Can't define option '${cfg.name}' - name is already in use by option '${storage2[0]}'!`
|
81135
81303
|
);
|
81136
81304
|
}
|
81137
81305
|
for (const alias of cfg.aliases) {
|
81138
|
-
for (const storage2 of
|
81306
|
+
for (const storage2 of storedNames) {
|
81139
81307
|
const nameOccupier = storage2.find((e2) => e2 === alias);
|
81140
81308
|
if (!nameOccupier)
|
81141
81309
|
continue;
|
81142
81310
|
throw new BroCliError(
|
81143
|
-
`Can't define option '${cfg.name}'
|
81311
|
+
`Can't define option '${cfg.name}' - alias '${alias}' is already in use by option '${storage2[0]}'!`
|
81144
81312
|
);
|
81145
81313
|
}
|
81146
81314
|
}
|
81147
|
-
|
81148
|
-
storedNames
|
81149
|
-
|
81315
|
+
const currentNames = [cfg.name, ...cfg.aliases];
|
81316
|
+
storedNames.push(currentNames);
|
81317
|
+
currentNames.forEach((name, idx) => {
|
81318
|
+
if (currentNames.findIndex((e2) => e2 === name) === idx)
|
81150
81319
|
return;
|
81151
81320
|
throw new BroCliError(
|
81152
|
-
`Can't define option '${cfg.name}'
|
81321
|
+
`Can't define option '${cfg.name}' - duplicate alias '${name}'!`
|
81153
81322
|
);
|
81154
81323
|
});
|
81155
81324
|
entries.push([key, { config: cfg, $output: void 0 }]);
|
@@ -81170,14 +81339,17 @@ var command = (command2) => {
|
|
81170
81339
|
`Can't define command '${cmd.name}' - command can't have subcommands and positional args at the same time!`
|
81171
81340
|
);
|
81172
81341
|
}
|
81342
|
+
if (!command2.handler && !command2.subcommands) {
|
81343
|
+
throw new BroCliError(
|
81344
|
+
`Can't define command '${cmd.name}' - command without subcommands must have a handler present!`
|
81345
|
+
);
|
81346
|
+
}
|
81173
81347
|
const processedOptions = command2.options ? validateOptions(command2.options) : void 0;
|
81174
81348
|
cmd.options = processedOptions;
|
81175
81349
|
cmd.name = cmd.name ?? ((_a = cmd.aliases) == null ? void 0 : _a.shift());
|
81176
81350
|
if (!cmd.name)
|
81177
81351
|
throw new BroCliError(`Can't define command without name!`);
|
81178
81352
|
cmd.aliases = ((_b = cmd.aliases) == null ? void 0 : _b.length) ? cmd.aliases : void 0;
|
81179
|
-
if (!cmd.handler)
|
81180
|
-
throw new BroCliError(`Can't define command '${cmd.name}' - command must have a handler!`);
|
81181
81353
|
if (cmd.name.startsWith("-")) {
|
81182
81354
|
throw new BroCliError(`Can't define command '${cmd.name}' - command name can't start with '-'!`);
|
81183
81355
|
}
|
@@ -81207,7 +81379,7 @@ var command = (command2) => {
|
|
81207
81379
|
}
|
81208
81380
|
return cmd;
|
81209
81381
|
};
|
81210
|
-
var getCommandInner = (commands, candidates, args) => {
|
81382
|
+
var getCommandInner = (commands, candidates, args, cliName, cliDescription) => {
|
81211
81383
|
const { data: arg, originalIndex: index4 } = candidates.shift();
|
81212
81384
|
const command2 = commands.find((c) => {
|
81213
81385
|
const names = c.aliases ? [c.name, ...c.aliases] : [c.name];
|
@@ -81228,12 +81400,20 @@ var getCommandInner = (commands, candidates, args) => {
|
|
81228
81400
|
};
|
81229
81401
|
}
|
81230
81402
|
const newCandidates = candidates.map((c) => ({ data: c.data, originalIndex: c.originalIndex - 1 }));
|
81231
|
-
const subcommand = getCommandInner(command2.subcommands, newCandidates, newArgs);
|
81232
|
-
if (!subcommand.command)
|
81233
|
-
throw
|
81403
|
+
const subcommand = getCommandInner(command2.subcommands, newCandidates, newArgs, cliName, cliDescription);
|
81404
|
+
if (!subcommand.command) {
|
81405
|
+
throw new BroCliError(void 0, {
|
81406
|
+
type: "error",
|
81407
|
+
violation: "unknown_subcommand_error",
|
81408
|
+
name: cliName,
|
81409
|
+
description: cliDescription,
|
81410
|
+
command: command2,
|
81411
|
+
offender: candidates[0].data
|
81412
|
+
});
|
81413
|
+
}
|
81234
81414
|
return subcommand;
|
81235
81415
|
};
|
81236
|
-
var getCommand = (commands, args) => {
|
81416
|
+
var getCommand = (commands, args, cliName, cliDescription) => {
|
81237
81417
|
var _a;
|
81238
81418
|
const candidates = [];
|
81239
81419
|
for (let i2 = 0; i2 < args.length; ++i2) {
|
@@ -81267,15 +81447,23 @@ var getCommand = (commands, args) => {
|
|
81267
81447
|
args: removeByIndex(args, firstCandidate.originalIndex)
|
81268
81448
|
};
|
81269
81449
|
}
|
81270
|
-
const { command: command2, args: argsRes } = getCommandInner(commands, candidates, args);
|
81271
|
-
if (!command2)
|
81272
|
-
throw
|
81450
|
+
const { command: command2, args: argsRes } = getCommandInner(commands, candidates, args, cliName, cliDescription);
|
81451
|
+
if (!command2) {
|
81452
|
+
throw new BroCliError(void 0, {
|
81453
|
+
type: "error",
|
81454
|
+
violation: "unknown_command_error",
|
81455
|
+
commands,
|
81456
|
+
name: cliName,
|
81457
|
+
description: cliDescription,
|
81458
|
+
offender: firstCandidate.data
|
81459
|
+
});
|
81460
|
+
}
|
81273
81461
|
return {
|
81274
81462
|
command: command2,
|
81275
81463
|
args: argsRes
|
81276
81464
|
};
|
81277
81465
|
};
|
81278
|
-
var parseArg = (options, positionals, arg, nextArg) => {
|
81466
|
+
var parseArg = (command2, options, positionals, arg, nextArg, cliName, cliDescription) => {
|
81279
81467
|
let data = void 0;
|
81280
81468
|
const argSplit = arg.split("=");
|
81281
81469
|
const hasEq = arg.includes("=");
|
@@ -81296,8 +81484,18 @@ var parseArg = (options, positionals, arg, nextArg) => {
|
|
81296
81484
|
if (!positionals.length)
|
81297
81485
|
return {};
|
81298
81486
|
const pos = positionals.shift();
|
81299
|
-
if (pos[1].enumVals && !pos[1].enumVals.find((val2) => val2 ===
|
81300
|
-
throw
|
81487
|
+
if (pos[1].enumVals && !pos[1].enumVals.find((val2) => val2 === arg)) {
|
81488
|
+
throw new BroCliError(void 0, {
|
81489
|
+
type: "error",
|
81490
|
+
name: cliName,
|
81491
|
+
description: cliDescription,
|
81492
|
+
violation: "enum_violation",
|
81493
|
+
command: command2,
|
81494
|
+
option: pos[1],
|
81495
|
+
offender: {
|
81496
|
+
dataPart: arg
|
81497
|
+
}
|
81498
|
+
});
|
81301
81499
|
}
|
81302
81500
|
data = arg;
|
81303
81501
|
return {
|
@@ -81332,32 +81530,126 @@ var parseArg = (options, positionals, arg, nextArg) => {
|
|
81332
81530
|
skipNext = false;
|
81333
81531
|
return true;
|
81334
81532
|
}
|
81335
|
-
throw
|
81533
|
+
throw new BroCliError(void 0, {
|
81534
|
+
type: "error",
|
81535
|
+
name: cliName,
|
81536
|
+
description: cliDescription,
|
81537
|
+
violation: "invalid_boolean_syntax",
|
81538
|
+
option: opt,
|
81539
|
+
command: command2,
|
81540
|
+
offender: {
|
81541
|
+
namePart,
|
81542
|
+
dataPart
|
81543
|
+
}
|
81544
|
+
});
|
81336
81545
|
} else {
|
81337
81546
|
const match2 = names.find((name) => name === namePart);
|
81338
81547
|
if (!match2)
|
81339
81548
|
return false;
|
81340
81549
|
if (opt.type === "string") {
|
81341
|
-
if (!hasEq && nextArg === void 0)
|
81342
|
-
throw
|
81550
|
+
if (!hasEq && nextArg === void 0) {
|
81551
|
+
throw new BroCliError(void 0, {
|
81552
|
+
type: "error",
|
81553
|
+
name: cliName,
|
81554
|
+
description: cliDescription,
|
81555
|
+
violation: "invalid_string_syntax",
|
81556
|
+
option: opt,
|
81557
|
+
command: command2,
|
81558
|
+
offender: {
|
81559
|
+
namePart,
|
81560
|
+
dataPart
|
81561
|
+
}
|
81562
|
+
});
|
81563
|
+
}
|
81343
81564
|
if (opt.enumVals && !opt.enumVals.find((val2) => val2 === dataPart)) {
|
81344
|
-
throw
|
81565
|
+
throw new BroCliError(void 0, {
|
81566
|
+
type: "error",
|
81567
|
+
name: cliName,
|
81568
|
+
description: cliDescription,
|
81569
|
+
violation: "enum_violation",
|
81570
|
+
option: opt,
|
81571
|
+
command: command2,
|
81572
|
+
offender: {
|
81573
|
+
namePart,
|
81574
|
+
dataPart
|
81575
|
+
}
|
81576
|
+
});
|
81345
81577
|
}
|
81346
81578
|
data = dataPart;
|
81347
81579
|
return true;
|
81348
81580
|
}
|
81349
|
-
if (!hasEq && nextArg === void 0)
|
81350
|
-
throw
|
81581
|
+
if (!hasEq && nextArg === void 0) {
|
81582
|
+
throw new BroCliError(void 0, {
|
81583
|
+
type: "error",
|
81584
|
+
name: cliName,
|
81585
|
+
description: cliDescription,
|
81586
|
+
violation: "invalid_number_syntax",
|
81587
|
+
option: opt,
|
81588
|
+
command: command2,
|
81589
|
+
offender: {
|
81590
|
+
namePart,
|
81591
|
+
dataPart
|
81592
|
+
}
|
81593
|
+
});
|
81594
|
+
}
|
81351
81595
|
const numData = Number(dataPart);
|
81352
|
-
if (isNaN(numData))
|
81353
|
-
throw
|
81354
|
-
|
81355
|
-
|
81356
|
-
|
81357
|
-
|
81358
|
-
|
81359
|
-
|
81360
|
-
|
81596
|
+
if (isNaN(numData)) {
|
81597
|
+
throw new BroCliError(void 0, {
|
81598
|
+
type: "error",
|
81599
|
+
name: cliName,
|
81600
|
+
description: cliDescription,
|
81601
|
+
violation: "invalid_number_value",
|
81602
|
+
option: opt,
|
81603
|
+
command: command2,
|
81604
|
+
offender: {
|
81605
|
+
namePart,
|
81606
|
+
dataPart
|
81607
|
+
}
|
81608
|
+
});
|
81609
|
+
}
|
81610
|
+
if (opt.isInt && !isInt(numData)) {
|
81611
|
+
throw new BroCliError(void 0, {
|
81612
|
+
type: "error",
|
81613
|
+
name: cliName,
|
81614
|
+
description: cliDescription,
|
81615
|
+
violation: "expected_int",
|
81616
|
+
option: opt,
|
81617
|
+
command: command2,
|
81618
|
+
offender: {
|
81619
|
+
namePart,
|
81620
|
+
dataPart
|
81621
|
+
}
|
81622
|
+
});
|
81623
|
+
}
|
81624
|
+
if (opt.minVal !== void 0 && numData < opt.minVal) {
|
81625
|
+
throw new BroCliError(void 0, {
|
81626
|
+
type: "error",
|
81627
|
+
name: cliName,
|
81628
|
+
description: cliDescription,
|
81629
|
+
violation: "below_min",
|
81630
|
+
option: opt,
|
81631
|
+
command: command2,
|
81632
|
+
offender: {
|
81633
|
+
namePart,
|
81634
|
+
dataPart
|
81635
|
+
}
|
81636
|
+
});
|
81637
|
+
}
|
81638
|
+
if (opt.maxVal !== void 0 && numData > opt.maxVal) {
|
81639
|
+
throw new BroCliError(void 0, {
|
81640
|
+
type: "error",
|
81641
|
+
name: cliName,
|
81642
|
+
description: cliDescription,
|
81643
|
+
violation: "above_max",
|
81644
|
+
option: opt,
|
81645
|
+
command: command2,
|
81646
|
+
offender: {
|
81647
|
+
namePart,
|
81648
|
+
dataPart
|
81649
|
+
}
|
81650
|
+
});
|
81651
|
+
}
|
81652
|
+
data = numData;
|
81361
81653
|
return true;
|
81362
81654
|
}
|
81363
81655
|
});
|
@@ -81368,7 +81660,7 @@ var parseArg = (options, positionals, arg, nextArg) => {
|
|
81368
81660
|
option: option == null ? void 0 : option[1]
|
81369
81661
|
};
|
81370
81662
|
};
|
81371
|
-
var parseOptions = (command2, args, omitKeysOfUndefinedOptions) => {
|
81663
|
+
var parseOptions = (command2, args, cliName, cliDescription, omitKeysOfUndefinedOptions) => {
|
81372
81664
|
const options = command2.options;
|
81373
81665
|
const optEntries = Object.entries(options ?? {}).map(
|
81374
81666
|
(opt) => [opt[0], opt[1].config]
|
@@ -81388,16 +81680,16 @@ var parseOptions = (command2, args, omitKeysOfUndefinedOptions) => {
|
|
81388
81680
|
skipNext,
|
81389
81681
|
isHelp,
|
81390
81682
|
isVersion
|
81391
|
-
} = parseArg(nonPositionalEntries, positionalEntries, arg, nextArg);
|
81683
|
+
} = parseArg(command2, nonPositionalEntries, positionalEntries, arg, nextArg, cliName, cliDescription);
|
81392
81684
|
if (!option)
|
81393
81685
|
unrecognizedArgsArr.push(arg.split("=")[0]);
|
81394
81686
|
if (skipNext)
|
81395
81687
|
++i2;
|
81396
|
-
result[name] = data;
|
81397
81688
|
if (isHelp)
|
81398
81689
|
return "help";
|
81399
81690
|
if (isVersion)
|
81400
81691
|
return "version";
|
81692
|
+
result[name] = data;
|
81401
81693
|
}
|
81402
81694
|
for (const [optKey, option] of optEntries) {
|
81403
81695
|
const data = result[optKey] ?? option.default;
|
@@ -81410,19 +81702,29 @@ var parseOptions = (command2, args, omitKeysOfUndefinedOptions) => {
|
|
81410
81702
|
if (option.isRequired && result[optKey] === void 0)
|
81411
81703
|
missingRequiredArr.push([option.name, ...option.aliases]);
|
81412
81704
|
}
|
81413
|
-
if (missingRequiredArr.length)
|
81414
|
-
throw
|
81415
|
-
|
81416
|
-
|
81417
|
-
|
81418
|
-
|
81419
|
-
|
81420
|
-
|
81421
|
-
|
81422
|
-
|
81423
|
-
|
81705
|
+
if (missingRequiredArr.length) {
|
81706
|
+
throw new BroCliError(void 0, {
|
81707
|
+
type: "error",
|
81708
|
+
violation: "missing_args_error",
|
81709
|
+
name: cliName,
|
81710
|
+
description: cliDescription,
|
81711
|
+
command: command2,
|
81712
|
+
missing: missingRequiredArr
|
81713
|
+
});
|
81714
|
+
}
|
81715
|
+
if (unrecognizedArgsArr.length) {
|
81716
|
+
throw new BroCliError(void 0, {
|
81717
|
+
type: "error",
|
81718
|
+
violation: "unrecognized_args_error",
|
81719
|
+
name: cliName,
|
81720
|
+
description: cliDescription,
|
81721
|
+
command: command2,
|
81722
|
+
unrecognized: unrecognizedArgsArr
|
81723
|
+
});
|
81724
|
+
}
|
81725
|
+
return Object.keys(result).length ? result : void 0;
|
81424
81726
|
};
|
81425
|
-
var
|
81727
|
+
var getCommandNameWithParents = (command2) => command2.parent ? `${getCommandNameWithParents(command2.parent)} ${command2.name}` : command2.name;
|
81426
81728
|
var validateCommands = (commands, parent) => {
|
81427
81729
|
const storedNames = {};
|
81428
81730
|
for (const cmd of commands) {
|
@@ -81431,8 +81733,8 @@ var validateCommands = (commands, parent) => {
|
|
81431
81733
|
const nameOccupier = storage2.find((e2) => e2 === cmd.name);
|
81432
81734
|
if (!nameOccupier)
|
81433
81735
|
continue;
|
81434
|
-
throw new
|
81435
|
-
`Can't define command '${
|
81736
|
+
throw new BroCliError(
|
81737
|
+
`Can't define command '${getCommandNameWithParents(cmd)}': name is already in use by command '${parent ? `${getCommandNameWithParents(parent)} ` : ""}${storage2[0]}'!`
|
81436
81738
|
);
|
81437
81739
|
}
|
81438
81740
|
if (cmd.aliases) {
|
@@ -81441,8 +81743,8 @@ var validateCommands = (commands, parent) => {
|
|
81441
81743
|
const nameOccupier = storage2.find((e2) => e2 === alias);
|
81442
81744
|
if (!nameOccupier)
|
81443
81745
|
continue;
|
81444
|
-
throw new
|
81445
|
-
`Can't define command '${
|
81746
|
+
throw new BroCliError(
|
81747
|
+
`Can't define command '${getCommandNameWithParents(cmd)}': alias '${alias}' is already in use by command '${parent ? `${getCommandNameWithParents(parent)} ` : ""}${storage2[0]}'!`
|
81446
81748
|
);
|
81447
81749
|
}
|
81448
81750
|
}
|
@@ -81454,53 +81756,135 @@ var validateCommands = (commands, parent) => {
|
|
81454
81756
|
return commands;
|
81455
81757
|
};
|
81456
81758
|
var removeByIndex = (arr, idx) => [...arr.slice(0, idx), ...arr.slice(idx + 1, arr.length)];
|
81457
|
-
var
|
81458
|
-
var rawCli = async (commands, config) => {
|
81759
|
+
var run = async (commands, config) => {
|
81459
81760
|
var _a, _b;
|
81460
|
-
const
|
81761
|
+
const eventHandler = (config == null ? void 0 : config.theme) ? eventHandlerWrapper(config.theme) : defaultEventHandler;
|
81461
81762
|
const argSource = (config == null ? void 0 : config.argSource) ?? process.argv;
|
81462
81763
|
const version3 = config == null ? void 0 : config.version;
|
81463
|
-
const
|
81764
|
+
const help = config == null ? void 0 : config.help;
|
81464
81765
|
const omitKeysOfUndefinedOptions = (config == null ? void 0 : config.omitKeysOfUndefinedOptions) ?? false;
|
81465
|
-
|
81466
|
-
|
81467
|
-
return await helpHandler(processedCmds);
|
81468
|
-
const helpIndex = args.findIndex((arg) => arg === "--help" || arg === "-h");
|
81469
|
-
if (helpIndex !== -1 && (helpIndex > 0 ? ((_a = args[helpIndex - 1]) == null ? void 0 : _a.startsWith("-")) && !args[helpIndex - 1].includes("=") ? false : true : true)) {
|
81470
|
-
const command3 = getCommand(processedCmds, args).command;
|
81471
|
-
return help(command3, processedCmds, helpHandler);
|
81472
|
-
}
|
81473
|
-
const versionIndex = args.findIndex((arg) => arg === "--version" || arg === "-v");
|
81474
|
-
if (versionIndex !== -1 && (versionIndex > 0 ? ((_b = args[versionIndex - 1]) == null ? void 0 : _b.startsWith("-")) ? false : true : true)) {
|
81475
|
-
return await executeOrLog(version3);
|
81476
|
-
}
|
81477
|
-
const { command: command2, args: newArgs } = getCommand(processedCmds, args);
|
81478
|
-
if (!command2)
|
81479
|
-
return helpHandler(processedCmds);
|
81480
|
-
if (command2 === "help") {
|
81481
|
-
const { command: helpCommand } = getCommand(processedCmds, newArgs);
|
81482
|
-
return help(helpCommand, processedCmds, helpHandler);
|
81483
|
-
}
|
81484
|
-
const optionResult = parseOptions(command2, newArgs, omitKeysOfUndefinedOptions);
|
81485
|
-
if (optionResult === "help")
|
81486
|
-
return await help(command2, commands, helpHandler);
|
81487
|
-
if (optionResult === "version")
|
81488
|
-
return await executeOrLog(version3);
|
81489
|
-
if (optionResult) {
|
81490
|
-
if (config == null ? void 0 : config.hook)
|
81491
|
-
await config.hook("pre", command2);
|
81492
|
-
await command2.handler(command2.transform ? await command2.transform(optionResult) : optionResult);
|
81493
|
-
if (config == null ? void 0 : config.hook)
|
81494
|
-
await config.hook("post", command2);
|
81495
|
-
}
|
81496
|
-
return void 0;
|
81497
|
-
};
|
81498
|
-
var run = async (commands, config) => {
|
81766
|
+
const cliName = config == null ? void 0 : config.name;
|
81767
|
+
const cliDescription = config == null ? void 0 : config.description;
|
81499
81768
|
try {
|
81500
|
-
|
81769
|
+
const processedCmds = validateCommands(commands);
|
81770
|
+
let args = argSource.slice(2, argSource.length);
|
81771
|
+
if (!args.length) {
|
81772
|
+
return help !== void 0 ? await executeOrLog(help) : await eventHandler({
|
81773
|
+
type: "global_help",
|
81774
|
+
description: cliDescription,
|
81775
|
+
name: cliName,
|
81776
|
+
commands: processedCmds
|
81777
|
+
});
|
81778
|
+
}
|
81779
|
+
const helpIndex = args.findIndex((arg) => arg === "--help" || arg === "-h");
|
81780
|
+
if (helpIndex !== -1 && (helpIndex > 0 ? ((_a = args[helpIndex - 1]) == null ? void 0 : _a.startsWith("-")) && !args[helpIndex - 1].includes("=") ? false : true : true)) {
|
81781
|
+
const command3 = getCommand(processedCmds, args, cliName, cliDescription).command;
|
81782
|
+
if (typeof command3 === "object") {
|
81783
|
+
return command3.help !== void 0 ? await executeOrLog(command3.help) : await eventHandler({
|
81784
|
+
type: "command_help",
|
81785
|
+
description: cliDescription,
|
81786
|
+
name: cliName,
|
81787
|
+
command: command3
|
81788
|
+
});
|
81789
|
+
} else {
|
81790
|
+
return help !== void 0 ? await executeOrLog(help) : await eventHandler({
|
81791
|
+
type: "global_help",
|
81792
|
+
description: cliDescription,
|
81793
|
+
name: cliName,
|
81794
|
+
commands: processedCmds
|
81795
|
+
});
|
81796
|
+
}
|
81797
|
+
}
|
81798
|
+
const versionIndex = args.findIndex((arg) => arg === "--version" || arg === "-v");
|
81799
|
+
if (versionIndex !== -1 && (versionIndex > 0 ? ((_b = args[versionIndex - 1]) == null ? void 0 : _b.startsWith("-")) ? false : true : true)) {
|
81800
|
+
return version3 !== void 0 ? await executeOrLog(version3) : await eventHandler({
|
81801
|
+
type: "version",
|
81802
|
+
name: cliName,
|
81803
|
+
description: cliDescription
|
81804
|
+
});
|
81805
|
+
}
|
81806
|
+
const { command: command2, args: newArgs } = getCommand(processedCmds, args, cliName, cliDescription);
|
81807
|
+
if (!command2) {
|
81808
|
+
return help !== void 0 ? await executeOrLog(help) : await eventHandler({
|
81809
|
+
type: "global_help",
|
81810
|
+
description: cliDescription,
|
81811
|
+
name: cliName,
|
81812
|
+
commands: processedCmds
|
81813
|
+
});
|
81814
|
+
}
|
81815
|
+
if (command2 === "help") {
|
81816
|
+
let helpCommand;
|
81817
|
+
let newestArgs = newArgs;
|
81818
|
+
do {
|
81819
|
+
const res = getCommand(processedCmds, newestArgs, cliName, cliDescription);
|
81820
|
+
helpCommand = res.command;
|
81821
|
+
newestArgs = res.args;
|
81822
|
+
} while (helpCommand === "help");
|
81823
|
+
return helpCommand ? helpCommand.help !== void 0 ? await executeOrLog(helpCommand.help) : await eventHandler({
|
81824
|
+
type: "command_help",
|
81825
|
+
description: cliDescription,
|
81826
|
+
name: cliName,
|
81827
|
+
command: helpCommand
|
81828
|
+
}) : help !== void 0 ? await executeOrLog(help) : await eventHandler({
|
81829
|
+
type: "global_help",
|
81830
|
+
description: cliDescription,
|
81831
|
+
name: cliName,
|
81832
|
+
commands: processedCmds
|
81833
|
+
});
|
81834
|
+
}
|
81835
|
+
const optionResult = parseOptions(command2, newArgs, cliName, cliDescription, omitKeysOfUndefinedOptions);
|
81836
|
+
if (optionResult === "help") {
|
81837
|
+
return command2.help !== void 0 ? await executeOrLog(command2.help) : await eventHandler({
|
81838
|
+
type: "command_help",
|
81839
|
+
description: cliDescription,
|
81840
|
+
name: cliName,
|
81841
|
+
command: command2
|
81842
|
+
});
|
81843
|
+
}
|
81844
|
+
if (optionResult === "version") {
|
81845
|
+
return version3 !== void 0 ? await executeOrLog(version3) : await eventHandler({
|
81846
|
+
type: "version",
|
81847
|
+
name: cliName,
|
81848
|
+
description: cliDescription
|
81849
|
+
});
|
81850
|
+
}
|
81851
|
+
if (command2.handler) {
|
81852
|
+
if (config == null ? void 0 : config.hook)
|
81853
|
+
await config.hook("before", command2);
|
81854
|
+
await command2.handler(command2.transform ? await command2.transform(optionResult) : optionResult);
|
81855
|
+
if (config == null ? void 0 : config.hook)
|
81856
|
+
await config.hook("after", command2);
|
81857
|
+
return;
|
81858
|
+
} else {
|
81859
|
+
return command2.help !== void 0 ? await executeOrLog(command2.help) : await eventHandler({
|
81860
|
+
type: "command_help",
|
81861
|
+
description: cliDescription,
|
81862
|
+
name: cliName,
|
81863
|
+
command: command2
|
81864
|
+
});
|
81865
|
+
}
|
81501
81866
|
} catch (e2) {
|
81502
|
-
|
81503
|
-
|
81867
|
+
if (e2 instanceof BroCliError) {
|
81868
|
+
if (e2.event)
|
81869
|
+
await eventHandler(e2.event);
|
81870
|
+
else {
|
81871
|
+
if (!(config == null ? void 0 : config.noExit))
|
81872
|
+
console.error(e2.message);
|
81873
|
+
else
|
81874
|
+
return e2.message;
|
81875
|
+
}
|
81876
|
+
} else {
|
81877
|
+
await eventHandler({
|
81878
|
+
type: "error",
|
81879
|
+
violation: "unknown_error",
|
81880
|
+
name: cliName,
|
81881
|
+
description: cliDescription,
|
81882
|
+
error: e2
|
81883
|
+
});
|
81884
|
+
}
|
81885
|
+
if (!(config == null ? void 0 : config.noExit))
|
81886
|
+
process.exit(1);
|
81887
|
+
return;
|
81504
81888
|
}
|
81505
81889
|
};
|
81506
81890
|
var OptionBuilderBase = class _OptionBuilderBase {
|
@@ -81578,7 +81962,7 @@ var OptionBuilderBase = class _OptionBuilderBase {
|
|
81578
81962
|
max(value) {
|
81579
81963
|
const config = this.config();
|
81580
81964
|
const minVal = config.minVal;
|
81581
|
-
if (minVal !== void 0 && minVal
|
81965
|
+
if (minVal !== void 0 && minVal > value) {
|
81582
81966
|
throw new BroCliError("Unable to define option's max value to be lower than min value!");
|
81583
81967
|
}
|
81584
81968
|
return new _OptionBuilderBase({ ...config, maxVal: value });
|
@@ -83402,7 +83786,7 @@ init_utils2();
|
|
83402
83786
|
var version2 = async () => {
|
83403
83787
|
const { npmVersion } = await ormCoreVersions();
|
83404
83788
|
const ormVersion = npmVersion ? `drizzle-orm: v${npmVersion}` : "";
|
83405
|
-
const envVersion = "0.24.0-
|
83789
|
+
const envVersion = "0.24.0-6386ea9";
|
83406
83790
|
const kitVersion = envVersion ? `v${envVersion}` : "--";
|
83407
83791
|
const versions = `drizzle-kit: ${kitVersion}
|
83408
83792
|
${ormVersion}`;
|
@@ -83437,6 +83821,7 @@ var legacy = [
|
|
83437
83821
|
legacyCommand("check:sqlite", "check")
|
83438
83822
|
];
|
83439
83823
|
run([generate, migrate, pull, push, studio, up, check, drop, ...legacy], {
|
83824
|
+
name: "drizzle-kit",
|
83440
83825
|
version: version2
|
83441
83826
|
});
|
83442
83827
|
/*! Bundled license information:
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "drizzle-kit",
|
3
|
-
"version": "0.24.0-
|
3
|
+
"version": "0.24.0-6386ea9",
|
4
4
|
"homepage": "https://orm.drizzle.team",
|
5
5
|
"keywords": [
|
6
6
|
"drizzle",
|
@@ -42,7 +42,7 @@
|
|
42
42
|
"publish": "npm publish package.tgz"
|
43
43
|
},
|
44
44
|
"dependencies": {
|
45
|
-
"@drizzle-team/brocli": "^0.
|
45
|
+
"@drizzle-team/brocli": "^0.10.1",
|
46
46
|
"@esbuild-kit/esm-loader": "^2.5.5",
|
47
47
|
"esbuild": "^0.19.7",
|
48
48
|
"esbuild-register": "^3.5.0"
|
@@ -92,7 +92,7 @@
|
|
92
92
|
"hono": "^4.1.5",
|
93
93
|
"json-diff": "1.0.6",
|
94
94
|
"minimatch": "^7.4.3",
|
95
|
-
"mysql2": "
|
95
|
+
"mysql2": "3.3.3",
|
96
96
|
"node-fetch": "^3.3.2",
|
97
97
|
"pg": "^8.11.5",
|
98
98
|
"pluralize": "^8.0.0",
|