fynjs API
    Preparing search index...

    Type Alias NixClapConfig

    Configuration options for NixClap.

    type NixClapConfig = {
        allowDuplicateOption?: boolean;
        allowUnknownCommand?: boolean;
        allowUnknownOption?: boolean;
        cmdUsage?: string;
        config?: (command: CommandNode) => Record<string, any> | undefined | void;
        defaultCommand?: string;
        exit?: (code: number) => void;
        handlers?: Record<
            string,
            ((parsed?: ParseResult) => void | Promise<void>)
            | false,
        >;
        help?: OptionSpec | false;
        helpAlias?: string | string[];
        helpZebra?: boolean;
        name?: string;
        noDefaultHandlers?: boolean;
        output?: (text: string) => void;
        skipExec?: boolean;
        skipExecDefault?: boolean;
        unknownCommandFallback?: string;
        usage?: string;
        version?: number | string;
        versionAlias?: string;
    }
    Index
    allowDuplicateOption?: boolean

    Set to true to allow sub-commands to define options with the same name as parent commands. When enabled, sub-command options shadow (override) parent options at that command level. Options are resolved at the current command level first, then bubble up to parent if not found.

    Default is false (throws error if duplicate option names are found).

    allowUnknownCommand?: boolean

    When encounter an unknown command, take it and continue processing.

    allowUnknownOption?: boolean

    When encounter an unknown option, take it without creating an error. Each command can override this setting.

    cmdUsage?: string

    Generic usage message for commands. Can also set with the cmdUsage method.

    config?: (command: CommandNode) => Record<string, any> | undefined | void

    Load user config during parse. It's called after argv is parsed, before defaults, the required check and exec, so config can satisfy required and reach exec handlers. The command only holds CLI values at this point, like --cwd or --config. The result is applied with applyConfig and source user.

    defaultCommand?: string

    Name of the default command. It can be only one of the top level commands. Sub commands cannot be the default command.

    exit?: (code: number) => void

    Custom exit function. Default is to emit the exit event.

    handlers?: Record<
        string,
        ((parsed?: ParseResult) => void | Promise<void>)
        | false,
    >

    Custom event handlers.

    help?: OptionSpec | false

    Custom help option setting. Can also set with the help method.

    helpAlias?: string | string[]

    Alias for the help option. Default: ["?", "h"].

    helpZebra?: boolean

    Set to true to enable zebra striping (alternating dim rows) in help text for better readability when terminal is wide.

    name?: string

    Name of your app/program.

    noDefaultHandlers?: boolean

    Set to true to skip installing default handlers and always return the parsed result, and allow user to process and handle errors and show help.

    output?: (text: string) => void

    Function to output text. Default is write to stdout.

    skipExec?: boolean

    Set to true to skip calling command exec handlers after parse. In case you need to do some processing before invoking the exec handlers, you can set this flag and call the runExec method yourself.

    skipExecDefault?: boolean

    Set to true to skip calling default command exec handler after parse. In case you need to do some processing before invoking the exec handlers, you can set this flag and call the runExec method yourself.

    unknownCommandFallback?: string

    When encounter an unknown command at root level, treat it as arguments to this command. For example, with unknownCommandFallback: "run", prog unknown becomes prog run unknown.

    usage?: string

    Usage message. Can also set with the usage method.

    version?: number | string

    Version of your app/program.

    versionAlias?: string

    Alias for option to show version. Default: ["V", "v"].