import type minimist from "minimist"; import type { CommandArgumentSpec, CommandOptionSpec } from "@garden-io/grow-sdk/declarations/command"; import type { Parameter, ParameterObject, ParameterValues } from "@garden-io/grow-sdk/declarations/params"; import type { DeepPrimitiveMap } from "@garden-io/grow-sdk/util/types"; import type { BuiltinArgs, CommandWrapper } from "../config/wrapper"; import type { GlobalConfigStore } from "../config-store/global"; import type { Log } from "../logger/log-entry"; import type { Logger } from "../logger/logger"; export declare const cliStyles: { heading: (str: string) => string; commandPlaceholder: () => string; argumentsPlaceholder: () => string; optionsPlaceholder: () => string; globalOptionsPlaceholder: () => string; hints: (str: string) => string; usagePositional: (key: string, required: boolean, spread: boolean) => string; usageOption: (str: string) => string; }; /** * The maximum width of the help text that the CLI outputs. E.g. when running "garden --help" or "garden options". */ export declare function helpTextMaxWidth(): number; /** * checks if requirements to run are installed, throws if they are not */ export declare function checkRequirements(): Promise; export declare function checkForUpdates(config: GlobalConfigStore, logger: Log): Promise; export interface PickCommandResult { command: CommandWrapper | undefined; rest: string[]; matchedPath: string[] | undefined; } export declare function pickCommand(commands: CommandWrapper[], args: string[]): PickCommandResult; export declare function prepareMinimistOpts({ options, skipDefault, skipGlobalDefault, }: { options: { [key: string]: Parameter; }; skipDefault?: boolean; skipGlobalDefault?: boolean; }): { boolean: string[]; string: string[]; alias: { [key: string]: string[]; }; default: { [key: string]: unknown; }; }; /** * Takes parsed arguments (as returned by minimist) and validates them, and * returns resolved args and opts. See processCommandArgs() below for a wrapper made for specific commands. * * @param parsedArgs Parsed arguments from minimist * @param command The Command that the arguments are for */ export declare function processArgs({ rawArgs, parsedArgs, argSpec, optSpec, allowUndefinedArguments, }: { rawArgs: string[]; parsedArgs: minimist.ParsedArgs; argSpec: A; optSpec: O; allowUndefinedArguments: boolean; }): { args: BuiltinArgs & ParameterValues; opts: ParameterValues; }; /** * Takes parsed arguments (as returned by minimist) and a Command, validates them, and * returns args and opts ready to pass to that command's action method. * * @param parsedArgs Parsed arguments from minimist * @param command The Command that the arguments are for */ export declare function processCommandArgs({ rawArgs, parsedArgs, command, matchedPath, }: { rawArgs: string[]; parsedArgs: minimist.ParsedArgs; command: CommandWrapper; matchedPath?: string[]; }): { args: BuiltinArgs & ParameterValues>; opts: ParameterValues>; }; export declare function optionsWithAliasValues(command: CommandWrapper, parsedOpts: DeepPrimitiveMap): DeepPrimitiveMap; /** * Parse command line --input input, return as an object. * Handles nested keys (e.g. --input.foo=bar) if allowNested=true and arrays (e.g. --input=foo --input=bar). */ export declare function parseCliInputFlags(inputs: string[] | undefined, allowNested?: boolean): {}; export declare function getPopularCommands(commands: CommandWrapper[]): CommandWrapper[]; export declare function getOtherCommands(commands: CommandWrapper[]): CommandWrapper[]; export declare function renderCommands(commands: CommandWrapper[]): string; export declare function renderArguments(params: ParameterObject): string; export declare function renderOptions(params: ParameterObject): string; export declare function renderCommandErrors(logger: Logger, errors: Error[], log?: Log): void; export declare function getDashboardInfoMsg(): string; export declare function hasHelpFlag(argv: minimist.ParsedArgs): any; export declare function getGitInfo(): Promise<{ commitHash: string | null; branchName: string | null; repositoryUrl: string | null; isDirty: boolean | null; }>;