@grandlinex/easy-cli
Version:
Cli lib to perform common tasks
28 lines (27 loc) • 942 B
TypeScript
import { CoreLogChannel, CoreLogger } from '@grandlinex/core';
import { CmdProperty, IArgs, IHandler, ParamTypeRaw } from '../lib/types.js';
export type ShellCommandParentProps = {
logger: CoreLogger;
handler: IHandler;
};
export type ShellCommandProps = {
name: string;
description: string;
properties: CmdProperty[];
subCommands?: ShellCommand[];
level?: number;
} & ShellCommandParentProps;
export declare abstract class ShellCommand<T = any> extends CoreLogChannel {
name: string;
level: number;
description: string;
handler: IHandler<T>;
properties: CmdProperty[];
subCommands: ShellCommand[];
protected constructor(conf: ShellCommandProps);
private validateFields;
start(parser: IArgs): Promise<boolean>;
abstract run(parser: IArgs): Promise<boolean>;
protected resolvePath(path?: ParamTypeRaw): string;
protected getStatic(key: string): string | undefined;
}