Import other modules into monorepo
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2021-06-01 20:59:40 -05:00
parent 26d54033af
commit 9be9c44a32
138 changed files with 11544 additions and 139 deletions

View File

@@ -0,0 +1,45 @@
import {CLIOption} from "./CLIOption"
/**
* Non-positional, flag-based CLI option.
*/
export class FlagOption<T> extends CLIOption<T> {
constructor(
/**
* The long-form flag for this option.
* @example --path, --create
*/
public readonly longFlag?: string,
/**
* The short-form flag for this option.
* @example -p, -c
*/
public readonly shortFlag?: string,
/**
* Usage message describing this flag.
*/
public readonly message?: string,
/**
* Description of the argument required by this flag.
* If this is set, the flag will expect a positional argument to follow as a param.
*/
public readonly argumentDescription?: string
) { super() }
/**
* Get the referential name for this option.
* Defaults to the long flag (without the '--'). If this cannot
* be found, the short flag (without the '-') is used.
* @returns {string}
*/
getArgumentName() {
if ( this.longFlag ) {
return this.longFlag.replace('--', '')
} else if ( this.shortFlag ) {
return this.shortFlag.replace('-', '')
}
throw new Error('Missing either a long- or short-flag for FlagOption.')
}
}