/** * Represents a single command-line flag. */ export declare class Flag { readonly name: string; readonly description: string; readonly required: boolean; readonly type: FlagType; readonly default: string; private internalIsPresent; private internalValue; constructor(config: FlagConfig); /** * Returns true if this flag is present on this run. Will always return false * before flags are parsed with StrictFlags.parse(). */ isPresent(): boolean; /** * Returns the value of this flag, if this flag is a PROPERTY type and has * a value. Otherwise returns the default. * @throws Throws if this flag is not a PROPERTY. */ get(): string; /** * Marks this flag as present. Should only be used in tests or by the actual * StrictFlags code. If this flag is PROPERTY type, a non-null value must be * supplied. * @throws Throws if this is a PROPERTY flag and no non-null value was * provided. Also throws if this is a FLAG flag and any value is provided. */ setPresence(value?: string | null): void; /** * Given a list of arguments, tries to locate this flag within them. If * successful, sets presence and value, or throws if something is amiss. * Removes itself from the list of arguments once complete. */ parse(args: string[]): string[]; /** * Returns the leading dashes that are used to form this entire flag. */ getPrefix(): string; /** * Returns the full name of this flag, with the leading dashes. */ getFullName(): string; private throwNoValueError; /** * Asserts the given config is valid by verifying the following conditions * are true: * * - If this has the FLAG type, it does not also include a default. * * - The flag name is not a reserved flag name. */ private static assertConfigValid; } export interface FlagConfig { /** * The name of the flag, without the preceding dashes. Typically this is in * kebab-case, ie. "my-cool-flag". */ name: string; /** * The description of the flag, used when a user runs "yourcli --help" or * "yourcli help ". */ description: string; /** * Defaults to false. Whether or not to stop execution and alert if this flag * isn't present. */ required?: boolean; /** * Defaults to FLAG. The type of this flag. */ type?: FlagType; /** * Defaults to an empty string. The default value to fall back on if no value * is provided by the user. */ default?: string; internalOnlyDoNotUseIsBuiltIn?: boolean; } export declare enum FlagType { FLAG = 0, PROPERTY = 1 }