import type * as v from '@badrap/valita'; import { type CommandBuilder, type RunState } from '../core/index.js'; import { Option, type OptionFlags, type OptionReturn, type WithArity } from './base.js'; export type StringNamedOptionNoBoolean = OptionFlags & { validator?: v.Type; tolerateBoolean?: false; arity?: Arity; }; export type StringNamedOptionTolerateBoolean = OptionFlags & { validator?: v.Type; tolerateBoolean: boolean; arity?: 0; }; export type StringNamedOptionFlags = StringNamedOptionNoBoolean | StringNamedOptionTolerateBoolean; export type StringPositionalOptionFlags = { validator?: v.Type; name?: string; required?: boolean; }; export declare class StringOption extends Option { description: string | undefined; required: boolean; hidden: boolean; descriptor: string[]; initialValue: WithArity | string | boolean | undefined; arity: number; tolerateBoolean: boolean; validator: v.Type | undefined; constructor(descriptor: string[], initialValue: WithArity | string | boolean | undefined, options: StringNamedOptionFlags); define(builder: CommandBuilder, _key: string): void; transform(_builder: CommandBuilder, key: string, state: RunState): T; } /** * Used to annotate positional options. Such options will be strings * unless they are provided a schema, which will then be used for coercion. * * Be careful: this function is order-dependent! Make sure to define your * positional options in the same order you expect to find them on the * command line. */ export declare function String(): OptionReturn; export declare function String(opts: StringPositionalOptionFlags & { required: false; }): OptionReturn; export declare function String(opts: StringPositionalOptionFlags): OptionReturn; /** * Used to annotate string options. Such options will be typed as strings * unless they are provided a schema, which will then be used for coercion. * * @example * --foo=hello --bar world * ► {"foo": "hello", "bar": "world"} */ export declare function String(descriptor: string[], opts: StringNamedOptionNoBoolean & { required: true; }): OptionReturn>; export declare function String(descriptor: string[], opts?: StringNamedOptionNoBoolean): OptionReturn | undefined>; export declare function String(descriptor: string[], initialValue: WithArity, opts?: Omit, 'required'>): OptionReturn>; export declare function String(descriptor: string[], opts: StringNamedOptionTolerateBoolean & { required: true; }): OptionReturn; export declare function String(descriptor: string[], opts: StringNamedOptionTolerateBoolean): OptionReturn; export declare function String(descriptor: string[], initialValue: string | boolean, opts: Omit, 'required'>): OptionReturn;