commanding
Version:
A simple yet practical command-Line application framework, written in TypeScript.
30 lines (29 loc) • 1.95 kB
TypeScript
/// <reference types="node" />
import { Application as ApplicationInterface, Presenter, Command, ParsedOptions, MappedOptions, OptionRequirement, Logger, ParsedArgs } from './interfaces';
import { LogLevel } from './loggers/constant';
export declare class Application implements ApplicationInterface {
protected name: string | undefined;
protected description: string | undefined;
protected version: string | undefined;
protected commands: Command[];
protected defaultCommand?: Command | undefined;
protected commandMap: {
[name: string]: Command;
};
constructor(name: string | undefined, description: string | undefined, version: string | undefined, commands: Command[], defaultCommand?: Command | undefined);
protected hasSubCommand(): boolean;
protected hasDefaultCommand(): boolean;
protected matchCommand(name: string): Command | undefined;
protected getGlobalOptionRequirements(): OptionRequirement[];
makeDefaultPresenter(colorEnabled?: boolean, output?: NodeJS.WriteStream): Presenter;
makeDefaultLogger(level?: LogLevel, colorEnabled?: boolean, standardOutput?: NodeJS.WriteStream, errorOutput?: NodeJS.WriteStream): Logger;
protected getGlobalOptions(parsedOptions: ParsedOptions): MappedOptions;
protected containHelpCommand(parsedArgs: ParsedArgs): boolean;
execute(executable: string, parsedArgs: ParsedArgs, parsedOptions: ParsedOptions, presenter: Presenter, logger: Logger): Promise<void>;
parse(argv: string[], customPresenter?: Presenter, customLogger?: Logger): Promise<void>;
renderApplicationInfo(executable: string, presenter: Presenter): void;
protected shouldShowCommandHelp(parsedArgs: ParsedArgs, globalOptions: MappedOptions): boolean;
showHelp(executable: string, presenter: Presenter): void;
showCommandHelp(executable: string, command: Command, presenter: Presenter): void;
showVersion(presenter: Presenter): void;
}