@cenk1cenk2/oclif-common 3.2.0 → 3.2.1
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 -6
- package/dist/index.js +11 -14
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -296,7 +296,7 @@ declare type DeepPartial<T> = {
|
|
|
296
296
|
[P in keyof T]?: DeepPartial<T[P]>;
|
|
297
297
|
};
|
|
298
298
|
|
|
299
|
-
declare
|
|
299
|
+
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 {
|
|
300
300
|
static globalFlags: {
|
|
301
301
|
"log-level": _oclif_core_lib_interfaces.OptionFlag<string>;
|
|
302
302
|
ci: _oclif_core_lib_interfaces.BooleanFlag<boolean>;
|
|
@@ -321,22 +321,21 @@ declare abstract class Command<Ctx extends ListrContext = ListrContext, Flags ex
|
|
|
321
321
|
* Deconstruct the class if you dont want to extend finally or catch.
|
|
322
322
|
*/
|
|
323
323
|
shouldRunAfter(_ctx?: Ctx): void | Promise<void>;
|
|
324
|
-
|
|
325
|
-
runTasks<C extends Ctx = Ctx>(): Promise<C>;
|
|
324
|
+
run(): Promise<void>;
|
|
326
325
|
/** Tasks to run before end of the command. */
|
|
327
326
|
finally<C extends Ctx = Ctx>(): Promise<{
|
|
328
327
|
ctx: C;
|
|
329
328
|
}>;
|
|
330
329
|
/** Catch any error occurred during command. */
|
|
331
330
|
catch(e: Error): Promise<void>;
|
|
331
|
+
exit(code?: number): void;
|
|
332
|
+
/** Run all tasks from task manager. */
|
|
333
|
+
runTasks<C extends Ctx = Ctx>(): Promise<C>;
|
|
332
334
|
/** Gets prompt from user. */
|
|
333
335
|
prompt<T = any>(options: PromptOptions): Promise<T>;
|
|
334
336
|
setCtxDefaults(...defaults: SetCtxDefaultsOptions<Ctx>[]): void;
|
|
335
337
|
setCtxAssign<K = Record<PropertyKey, any>>(...assigns: SetCtxAssignOptions<K>[]): void;
|
|
336
|
-
exit(code?: number): void;
|
|
337
338
|
private greet;
|
|
338
|
-
/** Every command needs to implement run for running the command itself. */
|
|
339
|
-
abstract run(): Promise<void>;
|
|
340
339
|
}
|
|
341
340
|
|
|
342
341
|
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> {
|
package/dist/index.js
CHANGED
|
@@ -1034,15 +1034,8 @@ var Command = class extends import_core2.Command {
|
|
|
1034
1034
|
}
|
|
1035
1035
|
shouldRunAfter(_ctx) {
|
|
1036
1036
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
const ctx = await this.tasks.runAll();
|
|
1040
|
-
return ctx;
|
|
1041
|
-
} catch (e) {
|
|
1042
|
-
this.logger.fatal(e.message);
|
|
1043
|
-
this.logger.debug(e.stack, { context: "crash" });
|
|
1044
|
-
process.exit(126);
|
|
1045
|
-
}
|
|
1037
|
+
run() {
|
|
1038
|
+
return;
|
|
1046
1039
|
}
|
|
1047
1040
|
async finally() {
|
|
1048
1041
|
const ctx = await this.runTasks();
|
|
@@ -1052,7 +1045,15 @@ var Command = class extends import_core2.Command {
|
|
|
1052
1045
|
catch(e) {
|
|
1053
1046
|
this.logger.fatal(e.message);
|
|
1054
1047
|
this.logger.debug(e.stack, { context: "crash" });
|
|
1055
|
-
|
|
1048
|
+
this.exit(127);
|
|
1049
|
+
return;
|
|
1050
|
+
}
|
|
1051
|
+
exit(code) {
|
|
1052
|
+
this.logger.trace("Exitting with code: %d", code);
|
|
1053
|
+
this.exit(code ?? 0);
|
|
1054
|
+
}
|
|
1055
|
+
runTasks() {
|
|
1056
|
+
return this.tasks.runAll();
|
|
1056
1057
|
}
|
|
1057
1058
|
prompt(options) {
|
|
1058
1059
|
try {
|
|
@@ -1073,10 +1074,6 @@ var Command = class extends import_core2.Command {
|
|
|
1073
1074
|
setCtxAssign(...assigns) {
|
|
1074
1075
|
return setCtxAssign(this.tasks.options.ctx, ...assigns);
|
|
1075
1076
|
}
|
|
1076
|
-
exit(code) {
|
|
1077
|
-
this.logger.trace("Exitting with code: %d", code);
|
|
1078
|
-
process.exit(code ?? 0);
|
|
1079
|
-
}
|
|
1080
1077
|
greet() {
|
|
1081
1078
|
if (this.cs.isSilent || this.cs.json) {
|
|
1082
1079
|
return;
|