import { Command, CommandConfig } from "./command"; import { Flag, FlagConfig } from "./flag"; import { CommandListener } from "./commandlisteners/command_listener"; /** * Class which parses and manages commands and flags. */ export declare class StrictArgs { readonly name: string; readonly description: string | null; readonly commands: Map; readonly globalFlags: Map; private readonly commandListeners; private readonly beforeCommandCallbacks; private readonly infoAction; private readonly logger; constructor(name: string, description?: string | null, throwErrors?: boolean); /** * Registers a new command for this CLI. */ registerCommand(config: CommandConfig): Command; /** * Registers a new flag as a global flag. */ registerGlobalFlag(config: FlagConfig): Flag; /** * Registers a command listener class that will be called whenever a command * is matched successfully. */ addCommandListener(commandName: string, makeListener: (args: StrictArgs) => CommandListener): void; /** * Registers the given callback to be called after parsing is complete but * before command listeners are notified. Useful for setting up global data * based on global flags. */ beforeCommand(callback: BeforeCommandCallback): void; /** * 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; /** * Parses the given command-line arguments, printing out help text and * warnings to the console as needed. */ parse(args: string[]): void; private notifyHelpCommandListener; private notifyCommandListeners; private notifyBeforeCommandListeners; private assertCommandNotRegistered; private assertFlagNotRegistered; private registerBuiltIns; } export type BeforeCommandCallback = (args: StrictArgs) => void;