2016-08-26 07:21:42 +00:00
|
|
|
/// <reference types="q" />
|
2016-10-14 22:56:02 +00:00
|
|
|
import * as q from 'q';
|
|
|
|
import { Objectmap } from 'lik';
|
2016-12-18 00:36:19 +00:00
|
|
|
export interface ICommandDeferredObject {
|
2016-08-26 09:52:09 +00:00
|
|
|
commandName: string;
|
2016-12-18 00:36:19 +00:00
|
|
|
deferred: q.Deferred<any>;
|
2016-08-26 09:52:09 +00:00
|
|
|
}
|
2016-06-10 01:10:21 +00:00
|
|
|
export declare class Smartcli {
|
2016-06-10 01:48:01 +00:00
|
|
|
argv: any;
|
2016-06-10 01:10:21 +00:00
|
|
|
questionsDone: any;
|
2016-06-10 01:48:01 +00:00
|
|
|
parseStarted: any;
|
|
|
|
commands: any;
|
2016-06-10 01:10:21 +00:00
|
|
|
questions: any;
|
2016-06-10 01:48:01 +00:00
|
|
|
version: string;
|
2016-12-18 00:36:19 +00:00
|
|
|
/**
|
|
|
|
* map of all Command/Promise objects to keep track
|
|
|
|
*/
|
|
|
|
allCommandDeferredsMap: Objectmap<ICommandDeferredObject>;
|
2016-06-10 01:10:21 +00:00
|
|
|
constructor();
|
2016-08-26 07:21:42 +00:00
|
|
|
/**
|
|
|
|
* adds an alias, meaning one equals the other in terms of triggering associated commands
|
|
|
|
*/
|
2016-06-10 01:48:01 +00:00
|
|
|
addAlias(keyArg: any, aliasArg: any): void;
|
2016-08-26 07:21:42 +00:00
|
|
|
/**
|
|
|
|
* adds a Command by returning a Promise that reacts to the specific commandString given.
|
|
|
|
* Note: in e.g. "npm install something" the "install" is considered the command.
|
|
|
|
*/
|
2016-06-10 01:10:21 +00:00
|
|
|
addCommand(definitionArg: {
|
|
|
|
commandName: string;
|
2016-10-14 22:56:02 +00:00
|
|
|
}): q.Promise<any>;
|
2016-08-26 07:21:42 +00:00
|
|
|
/**
|
|
|
|
* gets a Promise for a command word
|
|
|
|
*/
|
2016-12-18 00:36:19 +00:00
|
|
|
getCommandPromiseByName(commandNameArg: string): q.Promise<void>;
|
|
|
|
/**
|
|
|
|
* triggers a command by name
|
|
|
|
* @param commandNameArg - the name of the command to trigger
|
|
|
|
*/
|
|
|
|
triggerCommandByName(commandNameArg: string): q.Promise<any>;
|
2016-08-26 09:52:09 +00:00
|
|
|
/**
|
|
|
|
* allows to specify help text to be printed above the rest of the help text
|
|
|
|
*/
|
|
|
|
addHelp(optionsArg: {
|
|
|
|
helpText: string;
|
2016-06-10 01:10:21 +00:00
|
|
|
}): void;
|
2016-08-26 09:52:09 +00:00
|
|
|
/**
|
|
|
|
* specify version to be printed for -v --version
|
|
|
|
*/
|
2016-06-10 01:10:21 +00:00
|
|
|
addVersion(versionArg: string): void;
|
2016-08-26 09:52:09 +00:00
|
|
|
/**
|
|
|
|
* returns promise that is resolved when no commands are specified
|
|
|
|
*/
|
2016-10-14 22:56:02 +00:00
|
|
|
standardTask(): q.Promise<any>;
|
2016-09-04 15:32:12 +00:00
|
|
|
/**
|
|
|
|
* start the process of evaluating commands
|
|
|
|
*/
|
2016-06-10 01:10:21 +00:00
|
|
|
startParse(): void;
|
2016-06-09 12:03:18 +00:00
|
|
|
}
|