breadc 0.4.2 → 0.4.3
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.cjs +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -179,7 +179,7 @@ const _Command = class {
|
|
|
179
179
|
}
|
|
180
180
|
async run(...args) {
|
|
181
181
|
if (this.actionFn) {
|
|
182
|
-
this.actionFn(...args, { logger: this.logger });
|
|
182
|
+
return await this.actionFn(...args, { logger: this.logger });
|
|
183
183
|
} else {
|
|
184
184
|
this.logger.warn(`You may miss action function in "${this.format}"`);
|
|
185
185
|
}
|
|
@@ -379,7 +379,7 @@ class Breadc {
|
|
|
379
379
|
async run(args) {
|
|
380
380
|
const parsed = this.parse(args);
|
|
381
381
|
if (parsed.command) {
|
|
382
|
-
parsed.command.run(...parsed.arguments, parsed.options);
|
|
382
|
+
return await parsed.command.run(...parsed.arguments, parsed.options);
|
|
383
383
|
}
|
|
384
384
|
}
|
|
385
385
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -52,7 +52,7 @@ declare class Command<F extends string = string, CommandOption extends object =
|
|
|
52
52
|
shouldRun(args: ParsedArgs): boolean;
|
|
53
53
|
parseArgs(args: ParsedArgs, globalOptions: Option[]): ParseResult;
|
|
54
54
|
action(fn: ActionFn<ExtractCommand<F>, CommandOption>): this;
|
|
55
|
-
run(...args: any[]): Promise<
|
|
55
|
+
run(...args: any[]): Promise<any>;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
interface AppOption {
|
|
@@ -93,7 +93,7 @@ declare type Push<T extends any[], U, R> = [...T, U, R];
|
|
|
93
93
|
declare type Context = {
|
|
94
94
|
logger: Logger;
|
|
95
95
|
};
|
|
96
|
-
declare type ActionFn<T extends any[], Option extends object = {}> = (...arg: Push<T, Option, Context>) =>
|
|
96
|
+
declare type ActionFn<T extends any[], Option extends object = {}, R = any> = (...arg: Push<T, Option, Context>) => R | Promise<R>;
|
|
97
97
|
/**
|
|
98
98
|
* Max Dep: 5
|
|
99
99
|
*
|
|
@@ -117,7 +117,7 @@ declare class Breadc<GlobalOption extends object = {}> {
|
|
|
117
117
|
command<F extends string>(format: F, description: string, config?: Omit<CommandConfig, 'description'>): Command<F, GlobalOption>;
|
|
118
118
|
command<F extends string>(format: F, config?: CommandConfig): Command<F, GlobalOption>;
|
|
119
119
|
parse(args: string[]): ParseResult;
|
|
120
|
-
run(args: string[]): Promise<
|
|
120
|
+
run(args: string[]): Promise<any>;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
declare function breadc(name: string, option?: AppOption): Breadc<{}>;
|
package/dist/index.mjs
CHANGED
|
@@ -172,7 +172,7 @@ const _Command = class {
|
|
|
172
172
|
}
|
|
173
173
|
async run(...args) {
|
|
174
174
|
if (this.actionFn) {
|
|
175
|
-
this.actionFn(...args, { logger: this.logger });
|
|
175
|
+
return await this.actionFn(...args, { logger: this.logger });
|
|
176
176
|
} else {
|
|
177
177
|
this.logger.warn(`You may miss action function in "${this.format}"`);
|
|
178
178
|
}
|
|
@@ -372,7 +372,7 @@ class Breadc {
|
|
|
372
372
|
async run(args) {
|
|
373
373
|
const parsed = this.parse(args);
|
|
374
374
|
if (parsed.command) {
|
|
375
|
-
parsed.command.run(...parsed.arguments, parsed.options);
|
|
375
|
+
return await parsed.command.run(...parsed.arguments, parsed.options);
|
|
376
376
|
}
|
|
377
377
|
}
|
|
378
378
|
}
|