Static Member Summary
Static Public Members | ||
public static get |
The name under which the module is available from the command line. |
|
public static get |
The filename used for configuration files. |
Constructor Summary
Public Constructor | ||
public |
constructor(argv: string[]) Creates a new AtSCMCli object based on command line arguments. |
Member Summary
Public Members | ||
public |
An instance of yargs responible for parsing options. |
|
public |
The options parsed from AtSCMCli#_argv. |
|
public |
|
Private Members | ||
private |
The raw, unparsed command line arguments the Cli was created with. |
|
private |
If requiring an external module failed. |
Method Summary
Public Methods | ||
public |
getEnvironment(findUp: boolean): Promise<Object> Returns a Liftoff.Environment for the Cli. |
|
public |
async getVersion(): Promise<{cli: string, local: ?string}>{cli:> Returns the CLI version and, if a local module could be found, the local version. |
|
public |
Parses arguments and runs the specified command. |
|
public |
Parses arguments and exposes the project options as environment variables. |
|
public |
async printVersion(): Promise<{cli: string, local: ?string}>{cli:> Gets and prints the CLI version and, if a local module could be found, the local version. |
|
public |
Gets a Liftoff.Environment and validates a config file and a local module was found. |
|
public |
runCommand(): Promise<*, Error> Runs the command specified in the command line arguments (AtSCMCli#_argv). |
Private Methods | ||
private |
_exposeOverride(config: Object, key: string, base: string) Used to expose project config overrides via environment variables. |
|
private |
_reportCliError(err: Error) Reports an error and exits the process with return code |
Static Public Members
Public Constructors
public constructor(argv: string[]) source
Creates a new AtSCMCli object based on command line arguments.
Params:
Name | Type | Attribute | Description |
argv | string[] | The command line arguments to use. If no command is provided and neither
|
Throw:
Throws an error if option parsing fails. |
Test:
Public Members
public options: Object source
The options parsed from AtSCMCli#_argv. Note that these options are not complete until AtSCMCli#launch was called.
public runViaCli: Boolean source
true
if the instance was created by running the binaries, false
if used programmatically.
Private Members
Public Methods
public getEnvironment(findUp: boolean): Promise<Object> source
Returns a Liftoff.Environment for the Cli.
Params:
Name | Type | Attribute | Description |
findUp | boolean |
|
If the environment should be searched for in parent directories. |
Test:
public async getVersion(): Promise<{cli: string, local: ?string}>{cli:> source
Returns the CLI version and, if a local module could be found, the local version.
Return:
Promise<{cli: string, local: ?string}>{cli:> | Fulfilled with the found cli and local version. |
Test:
public launch(): Promise<*, Error> source
Parses arguments and runs the specified command.
Return:
Promise<*, Error> | Fulfilled if the command succeeded. Note that, if the instance is run through the binary all rejections will be handled. |
Test:
public parseArguments(): Promise<Object, UsageError> source
Parses arguments and exposes the project options as environment variables.
Return:
Promise<Object, UsageError> | Rejected with a UsageError if parsing failed, otherwise fulfilled with the parsed arguments. |
Test:
public async printVersion(): Promise<{cli: string, local: ?string}>{cli:> source
Gets and prints the CLI version and, if a local module could be found, the local version.
Return:
Promise<{cli: string, local: ?string}>{cli:> | Fulfilled with the found cli and local version. |
Test:
public requireEnvironment(): Promise<Object, Error> source
Gets a Liftoff.Environment and validates a config file and a local module was found.
public runCommand(): Promise<*, Error> source
Runs the command specified in the command line arguments (AtSCMCli#_argv). Note that this will only work if AtSCMCli#parseArguments was called before..