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

73 lines
2.2 KiB
TypeScript
Raw Normal View History

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