@visulima/cerebro
Version:
A delightful toolkit for building cross-runtime CLIs for Node.js, Deno, and Bun.
45 lines (44 loc) • 2.47 kB
TypeScript
import type { OptionDefinition } from "../../types/command.d.ts";
import type { Toolbox as IToolbox } from "../../types/toolbox.d.ts";
/**
* Converts option names to camelCase and adds them as __camelCaseName__ properties.
* @template OD The option definition type
* @param command The command object containing options to process
* @param command.options The options array to process
*/
export declare const processOptionNames: <OD extends OptionDefinition<unknown>>(command: {
options?: OD[];
}) => void;
/**
* Adds negatable options for boolean flags.
* For options starting with "no-", creates a corresponding non-negated option.
* @template OD The option definition type
* @param command The command object to add negatable options to
* @param command.name The name of the command (used for error messages)
* @param command.options The array of option definitions to process
* @throws {Error} When a negated option is not of type Boolean
*/
export declare const addNegatableOptions: <OD extends OptionDefinition<unknown>>(command: {
name: string;
options?: OD[];
}) => void;
/**
* Maps negatable options to their non-negated counterparts.
* Processes toolbox options starting with "no" and converts them to non-negated form.
* @param toolbox The command toolbox containing options
* @param command The command object with option definitions
* @param command.options The command options array
*/
export declare const mapNegatableOptions: <O extends OptionDefinition<unknown>, TLogger extends Console = Console>(toolbox: IToolbox<TLogger>, command: {
options?: ReadonlyArray<O | OptionDefinition<boolean[]> | OptionDefinition<boolean> | OptionDefinition<number[]> | OptionDefinition<number> | OptionDefinition<string[]> | OptionDefinition<string>>;
}) => void;
/**
* Applies implied option values.
* Sets implied option values from option definitions that have an implies property.
* @param toolbox The command toolbox to apply implied values to
* @param command The command object with option definitions
* @param command.options The command options array
*/
export declare const mapImpliedOptions: <O extends OptionDefinition<unknown>, TLogger extends Console = Console>(toolbox: IToolbox<TLogger>, command: {
options?: ReadonlyArray<O | OptionDefinition<boolean[]> | OptionDefinition<boolean> | OptionDefinition<number[]> | OptionDefinition<number> | OptionDefinition<string[]> | OptionDefinition<string>>;
}) => void;