craydent-cli
Version:
Node module to manage command line execution and arguments
47 lines (46 loc) • 1.61 kB
TypeScript
import { AsyncFunction } from '../models/AsyncFunction';
import { AnyObject } from '../models/Generics';
import { Option, CLIOptions, ExecOptions, ExecCallback } from '../models/CLI';
export type ActionCallback = (this: CLI, arg: String) => any;
export type Output = {
output: String;
code: Number;
} | String | false | undefined;
declare class CLI {
Interpreter: String;
ScriptPath: String;
ScriptName: String;
Name: String;
Info: String;
Synopsis: String;
Copyright: String;
OptionsDescription: String;
Description: String;
UsingLabels: boolean;
CommandName: String;
Commands: AnyObject;
Options: any[];
Arguments: any[];
Notes: String;
isMan: boolean;
isHelp: boolean;
_commandIndex: String[];
_potentialCommand: String;
_commandRemoved: boolean;
waitForPending: Promise<any>[];
constructor(params?: CLIOptions);
isValid(): boolean;
validate(): void;
add(opt: Option): void;
option(opt: Option): void;
command(cmd: String, opts: Option | Option[]): this;
action(cb: ActionCallback | GeneratorFunction | AsyncFunction): this;
action(name: String, cb?: ActionCallback): this;
renderMan(): string;
renderHelp(): string;
static exec(command: String, callback: ExecCallback): Promise<Output>;
static exec(command: String, options?: ExecOptions, callback?: ExecCallback): Promise<Output>;
exec(command: String, callback: ExecCallback): Promise<Output>;
exec(command: String, options?: ExecOptions, callback?: ExecCallback): Promise<Output>;
}
export default CLI;