import { Flag, FlagConfig } from "./flag"; /** * Defines a single command that can be passed to a CLI. */ export declare class Command { readonly name: string; readonly description: string; readonly allowArguments: boolean; readonly longDescription: string; readonly syntaxHint: string | null; readonly flags: Map; private internalArgs; constructor(config: CommandConfig); /** * Adds a flag to this command. */ addFlag(flag: Flag): void; /** * Attempts to get args for this command. * @throws Throws if args aren't allowed for this command. */ getArgs(): string[]; /** * Returns the value of the flag with the specified name. If the flag wasn't * specified, returns the flag's default value. * @throws If no flag with the provided name exists, throws. */ getFlagValue(flagName: string): string; /** * Tries to parse all flags for this command. */ parse(args: string[]): void; /** * Verifies that the given config is valid by make sure the following * conditions are true: * * - The command name is not a reserved command name. */ private static assertConfigValid; } export interface CommandConfig { /** * The name of the command. This is typically all one word (ie. "run" or * "runquickly"). Cannot include spaces or other whitespace. */ name: string; /** * The description of this command that is shown when a user runs * "yourcli --help" or "yourcli help ". */ description: string; /** * An optional long description that is only printed when a user asks for the * full help information for this command. */ longDescription?: string; /** * An optional syntax hint (like "start ") that appears instead * of the automatically generated syntax hint in help printouts. */ syntaxHint?: string; /** * Defaults to an empty list. List of flags associated with this command. */ flags?: FlagConfig[]; /** * Defaults to false. If true, enables the use of loose arguments, ie. loose * values in the args that don't match any parameter or flag. */ allowArguments?: boolean; internalOnlyDoNotUseIsBuiltIn?: boolean; }