interface IFlag { name: string; defaultValue: T; description?: string; currentValue: T | null; validator?: (input: T | null) => boolean; isSecret: boolean; isSet: boolean; isRequired: boolean; setDefault(defaultValue: T): this; setRequired(required: boolean): this; setDescription(description: string): this; setValidator(validator: (input: T | null) => boolean): this; setSecret(isSecret: boolean): this; set(input: T): void; get(): T | null; parseInput(inp: string): T | null; toHelpString(): string; } declare global { var GLOBAL_FLAGS: { [key: string]: IFlag; }; } declare const FLAGS: { [key: string]: IFlag; }; /** * If true, then the process will be nicely exit on a parse error. If false, * an Error will be thrown. Set to false in tests. */ declare function setExitOnError(value: boolean): void; /** * Allows an app to add extra usage information that will be shown in the help * message, above the flags. */ declare function setUsageInfo(value: string): void; /** * Defines a string flag. e.g. --servername=bob */ declare function defineString(name: string, defaultValue?: string, description?: string): IFlag; /** * Defines a boolean flag. e.g. --turnonlights */ declare function defineBoolean(name: string, defaultValue?: boolean, description?: string): IFlag; /** * Defines an integer flag. e.g. --age=12 */ declare function defineInteger(name: string, defaultValue?: number, description?: string): IFlag; /** * Defines a number flag. e.g. --number=1.345 */ declare function defineNumber(name: string, defaultValue?: number, description?: string): IFlag; /** * Defines a string list flag. e.g. --animal=frog,bat,chicken */ declare function defineStringList(name: string, defaultValue?: string[], description?: string): IFlag; /** * Defines a multi string flag. e.g. --allowedip=127.0.0.1 --allowedip=127.0.0.2 */ declare function defineMultiString(name: string, defaultValue?: string[], description?: string): IFlag; /** * Dumps the help text to the console. */ declare function help(): void; /** * Resets the flag values. */ declare function reset(): void; /** * Gets the current value of the given flag. */ declare function get(name: string): unknown; /** * Gets whether or not the flag was set. */ declare function isSet(name: string): boolean; /** * Parses process.argv for flags. Idempotent if called multiple times. */ declare function parse(args?: string[], ignoreUnrecognized?: boolean): string[]; export { FLAGS, defineBoolean, defineInteger, defineMultiString, defineNumber, defineString, defineStringList, get, help, isSet, parse, reset, setExitOnError, setUsageInfo };