@cenk1cenk2/oclif-common 3.5.0 → 3.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -4
- package/dist/index.js +16 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -298,7 +298,7 @@ declare type DeepPartial<T> = {
|
|
|
298
298
|
};
|
|
299
299
|
|
|
300
300
|
declare class Command<Ctx extends ListrContext = ListrContext, Flags extends Record<PropertyKey, any> = InferFlags<typeof Command>, Args extends Record<PropertyKey, any> = InferArgs<typeof Command>, Store extends Record<PropertyKey, any> = Record<PropertyKey, any>> extends Command$1 {
|
|
301
|
-
static globalFlags:
|
|
301
|
+
static globalFlags: object;
|
|
302
302
|
logger: Logger;
|
|
303
303
|
tasks: Manager<Ctx, 'default' | 'verbose' | 'silent' | 'simple'>;
|
|
304
304
|
validator: ValidatorService;
|
|
@@ -336,13 +336,14 @@ declare class Command<Ctx extends ListrContext = ListrContext, Flags extends Rec
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
declare class ConfigCommand<CommandChoices extends string = string, LockFile = any, Ctx extends ListrContext = ListrContext, Flags extends Record<PropertyKey, any> = InferFlags<typeof ConfigCommand>, Args extends Record<PropertyKey, any> = InferArgs<typeof ConfigCommand>, Store extends Record<PropertyKey, any> = Record<PropertyKey, any>> extends Command<Ctx, Flags, Args, Store> {
|
|
339
|
-
static globalFlags:
|
|
339
|
+
static globalFlags: object;
|
|
340
340
|
choices: ConfigCommandChoices<CommandChoices>;
|
|
341
341
|
locker: LockerService<LockFile>;
|
|
342
|
+
private ux;
|
|
342
343
|
run(): Promise<void>;
|
|
343
|
-
|
|
344
|
+
construct(): ConfigCommandSetup<CommandChoices, LockFile> | Promise<ConfigCommandSetup<CommandChoices, LockFile>>;
|
|
344
345
|
protected table(...options: Parameters<typeof CliUx.ux.table>): void;
|
|
345
|
-
private
|
|
346
|
+
private select;
|
|
346
347
|
}
|
|
347
348
|
|
|
348
349
|
declare enum FileConstants {
|
package/dist/index.js
CHANGED
|
@@ -640,7 +640,9 @@ __name(merge, "merge");
|
|
|
640
640
|
// src/utils/defaults.ts
|
|
641
641
|
function setCtxDefaults(ctx, ...defaults) {
|
|
642
642
|
defaults?.forEach((i) => {
|
|
643
|
-
|
|
643
|
+
if (typeof i === "object" && !Array.isArray(i)) {
|
|
644
|
+
Object.assign(ctx, i);
|
|
645
|
+
}
|
|
644
646
|
});
|
|
645
647
|
}
|
|
646
648
|
__name(setCtxDefaults, "setCtxDefaults");
|
|
@@ -1030,7 +1032,7 @@ var Command = class extends import_core3.Command {
|
|
|
1030
1032
|
async init() {
|
|
1031
1033
|
let err;
|
|
1032
1034
|
try {
|
|
1033
|
-
const { flags, args } = await this.parse(
|
|
1035
|
+
const { flags, args } = await this.parse();
|
|
1034
1036
|
this.flags = flags;
|
|
1035
1037
|
this.args = args;
|
|
1036
1038
|
} catch (e) {
|
|
@@ -1082,7 +1084,7 @@ var Command = class extends import_core3.Command {
|
|
|
1082
1084
|
shouldRunAfter(_ctx) {
|
|
1083
1085
|
}
|
|
1084
1086
|
run() {
|
|
1085
|
-
|
|
1087
|
+
throw new Error("The command should have a run function to do something!");
|
|
1086
1088
|
}
|
|
1087
1089
|
async finally() {
|
|
1088
1090
|
this.logger.trace("tasks", { status: "stage" });
|
|
@@ -1136,25 +1138,30 @@ Command.globalFlags = CLI_FLAGS;
|
|
|
1136
1138
|
|
|
1137
1139
|
// src/commands/config.command.ts
|
|
1138
1140
|
var ConfigCommand = class extends Command {
|
|
1141
|
+
constructor() {
|
|
1142
|
+
super(...arguments);
|
|
1143
|
+
this.ux = import_core2.CliUx.ux;
|
|
1144
|
+
}
|
|
1139
1145
|
async run() {
|
|
1140
|
-
const setup2 = await this.
|
|
1146
|
+
const setup2 = await this.construct();
|
|
1141
1147
|
this.choices = setup2.choices;
|
|
1142
1148
|
this.locker = setup2.locker;
|
|
1143
|
-
await this.
|
|
1149
|
+
const response = await this.select();
|
|
1150
|
+
return this.choices[response].bind(this)();
|
|
1144
1151
|
}
|
|
1145
|
-
|
|
1152
|
+
construct() {
|
|
1146
1153
|
throw new Error("The command should be setup first!");
|
|
1147
1154
|
}
|
|
1148
1155
|
table(...options) {
|
|
1149
|
-
|
|
1156
|
+
this.ux.table(...options);
|
|
1150
1157
|
}
|
|
1151
|
-
async
|
|
1158
|
+
async select() {
|
|
1152
1159
|
const response = await this.prompt({
|
|
1153
1160
|
type: "Select",
|
|
1154
1161
|
message: "Please select what to do with the configuration.",
|
|
1155
1162
|
choices: Object.keys(this.choices)
|
|
1156
1163
|
});
|
|
1157
|
-
return
|
|
1164
|
+
return response;
|
|
1158
1165
|
}
|
|
1159
1166
|
};
|
|
1160
1167
|
__name(ConfigCommand, "ConfigCommand");
|