import { type ParsedArgs } from 'minimist'; import type { AuthOverrides } from '../overrides.js'; /** * How the CLI should behave when properties are not given as arguments. * * - `auto`: make the request as soon as every required property is given, * otherwise prompt for what is missing. This is the default. * - `interactive`: always prompt to review and edit properties, prefilled * with the given arguments. Selected with `--interactive` or `-i`. * - `non-interactive`: never prompt: anything missing is an error. * Selected with `--non-interactive` or `-y`. */ export type Interactivity = 'auto' | 'interactive' | 'non-interactive'; /** * Argument keys that select the interactivity * and are therefore not command parameters. */ export declare const interactivityFlags: string[]; /** * Argument keys that configure the CLI itself * and are therefore never sent as command parameters. */ export declare const cliFlags: string[]; export interface ParseCliArgsOptions { /** * Argument keys read exactly as given rather than by guessing at a type, * e.g., every parameter of an endpoint that does not take a number or a * boolean. Read as a number, an opaque value like an access code would * lose leading zeroes or turn exponent notation into a digit string. */ stringKeys?: string[]; /** Argument keys that must not consume the following positional word. */ booleanKeys?: string[]; } export declare const parseCliArgs: (argv: string[], { stringKeys, booleanKeys }?: ParseCliArgsOptions) => ParsedArgs; /** * The request params among the parsed arguments: every key normalized to * the parameter it names, minus the flags that configure the CLI itself. */ export declare const toArgParams: (args: ParsedArgs) => Record; /** * The auth overrides among the parsed arguments. * * Both scope a single command: they change what it resolves to and are never * stored, so they read like the environment variables they take precedence * over, down to treating a blank value as though it were not given. */ export declare const toAuthOverrides: (args: ParsedArgs) => AuthOverrides; export interface GetInteractivityOptions { /** * Whether there is a terminal to prompt on. * * When there is not, the CLI cannot ask for anything, so it behaves as * though `--non-interactive` was given rather than waiting on a prompt * nobody can answer. */ canPrompt?: boolean; } export declare const getInteractivity: (args: ParsedArgs, { canPrompt }?: GetInteractivityOptions) => Interactivity; /** * Render a parameter name as the argument used to set it, * e.g., `device_id` as `--device-id`. */ export declare const toArgName: (parameterName: string) => string; /** * Read an argument key as the parameter it names, e.g., `--page-cursor`, * `--page_cursor`, and `--PAGE-CURSOR` all name `page_cursor`. */ export declare const toParameterName: (argKey: string) => string; /** * Render an argument key as the argument it was given as, naming a one letter * key as the short form it can only have been written as, e.g., `-n`. */ export declare const toGivenArgName: (argKey: string) => string;