import { URL } from 'node:url'; import { BooleanFlag, CustomOptions, FlagDefinition, OptionFlag } from './interfaces'; type NotArray = T extends Array ? never : T; /** * Create a custom flag. * * @example * type Id = string * type IdOpts = { startsWith: string; length: number } * * export const myFlag = custom({ * parse: async (input, opts) => { * if (input.startsWith(opts.startsWith) && input.length === opts.length) { * return input * } * * throw new Error('Invalid id') * }, * }) */ export declare function custom(defaults: Partial> & { multiple: true; } & ({ default: OptionFlag['default']; } | { required: true; })): FlagDefinition; export declare function custom(defaults: Partial, P>> & { multiple?: false | undefined; } & ({ default: OptionFlag, P>['default']; } | { required: true; })): FlagDefinition; export declare function custom(defaults: Partial, P>> & { default?: OptionFlag, P>['default'] | undefined; multiple?: false | undefined; required?: false | undefined; }): FlagDefinition; export declare function custom(defaults: Partial> & { default?: OptionFlag['default'] | undefined; multiple: true; required?: false | undefined; }): FlagDefinition; export declare function custom(): FlagDefinition; /** * A boolean flag. Defaults to `false` unless default is set to `true`. * * - `allowNo` option allows `--no-` prefix to negate boolean flag. */ export declare function boolean(options?: Partial>): BooleanFlag; /** * An integer flag. Throws an error if the provided value is not a valid integer. * * - `min` option allows to set a minimum value. * - `max` option allows to set a maximum value. */ export declare const integer: FlagDefinition; /** * A directory flag. * * - `exists` option allows you to throw an error if the directory does not exist. */ export declare const directory: FlagDefinition; /** * A file flag. * * - `exists` option allows you to throw an error if the file does not exist. */ export declare const file: FlagDefinition; /** * A URL flag that converts the provided value is a string. * * Throws an error if the string is not a valid URL. */ export declare const url: FlagDefinition; /** * A string flag. */ export declare const string: FlagDefinition; /** * Version flag that will print the CLI version and exit. */ export declare const version: (opts?: Partial>) => BooleanFlag; /** * A help flag that will print the CLI help and exit. */ export declare const help: (opts?: Partial>) => BooleanFlag; type ReadonlyElementOf> = T[number]; /** * Create a custom flag that infers the flag type from the provided options. * * The provided `options` must be a readonly array in order for type inference to work. * * @example * export default class MyCommand extends Command { * static flags = { * name: Flags.option({ * options: ['foo', 'bar'] as const, * })(), * } * } */ export declare function option(defaults: Partial[], P>> & { multiple: true; options: T; } & ({ default: OptionFlag[], P>['default'] | undefined; } | { required: true; })): FlagDefinition<(typeof defaults.options)[number], P, { multiple: true; requiredOrDefaulted: true; }>; export declare function option(defaults: Partial, P>> & { multiple?: false | undefined; options: T; } & ({ default: OptionFlag, P>['default']; } | { required: true; })): FlagDefinition<(typeof defaults.options)[number], P, { multiple: false; requiredOrDefaulted: true; }>; export declare function option(defaults: Partial, P>> & { default?: OptionFlag, P>['default'] | undefined; multiple?: false | undefined; options: T; required?: false | undefined; }): FlagDefinition<(typeof defaults.options)[number], P, { multiple: false; requiredOrDefaulted: false; }>; export declare function option(defaults: Partial[], P>> & { default?: OptionFlag[], P>['default'] | undefined; multiple: true; options: T; required?: false | undefined; }): FlagDefinition<(typeof defaults.options)[number], P, { multiple: true; requiredOrDefaulted: false; }>; export {};