smartcli/dist/smartcli.classes.smartcli.d.ts

73 lines
2.2 KiB
TypeScript
Raw Normal View History

2017-04-22 20:09:51 +00:00
import * as smartq from 'smartq';
2016-12-18 19:53:50 +00:00
import { Subject } from 'rxjs';
import * as plugins from './smartcli.plugins';
2016-12-18 19:53:50 +00:00
export interface ICommandPromiseObject {
2016-08-26 09:52:09 +00:00
commandName: string;
2017-04-22 19:03:28 +00:00
promise: Promise<void>;
2016-12-18 19:53:50 +00:00
}
export interface ITriggerObservableObject {
triggerName: string;
2016-12-18 19:58:37 +00:00
subject: Subject<any>;
2016-08-26 09:52:09 +00:00
}
/**
* class to create a new instance of Smartcli. Handles parsing of command line arguments.
*/
export declare class Smartcli {
argv: any;
questionsDone: any;
2017-04-22 20:09:51 +00:00
parseStarted: smartq.Deferred<any>;
commands: any;
questions: any;
version: string;
private onlyOnProcessEnvCliCall;
2016-12-18 00:36:19 +00:00
/**
* map of all Trigger/Observable objects to keep track
2016-12-18 00:36:19 +00:00
*/
allTriggerObservablesMap: plugins.lik.Objectmap<ITriggerObservableObject>;
2016-12-18 19:53:50 +00:00
/**
* The constructor of Smartcli
2016-12-18 19:53:50 +00:00
*/
constructor();
/**
* halts any execution of commands if (process.env.CLI_CALL === false)
*/
onlyTriggerOnProcessEnvCliCall(): void;
2016-08-26 07:21:42 +00:00
/**
2016-12-18 19:53:50 +00:00
* adds an alias, meaning one equals the other in terms of command execution.
2016-08-26 07:21:42 +00:00
*/
2016-12-18 19:53:50 +00:00
addCommandAlias(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.
*/
addCommand(commandNameArg: string): Subject<any>;
2016-12-18 00:36:19 +00:00
/**
2016-12-18 19:53:50 +00:00
* adds a Trigger. Like addCommand(), but returns an subscribable observable
*/
2016-12-18 19:58:37 +00:00
addTrigger(triggerNameArg: string): Subject<any>;
2016-12-18 19:53:50 +00:00
/**
* execute trigger by name
2016-12-18 00:36:19 +00:00
* @param commandNameArg - the name of the command to trigger
*/
2016-12-18 19:58:37 +00:00
trigger(triggerName: string): Subject<any>;
getTriggerSubject(triggerName: string): Subject<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;
}): void;
2016-08-26 09:52:09 +00:00
/**
* specify version to be printed for -v --version
*/
addVersion(versionArg: string): void;
2016-08-26 09:52:09 +00:00
/**
* adds a trigger that is called when no command is specified
2016-08-26 09:52:09 +00:00
*/
standardTask(): Subject<any>;
2016-09-04 15:32:12 +00:00
/**
* start the process of evaluating commands
*/
startParse(): void;
2016-06-09 12:03:18 +00:00
}