UNPKG

cmpstr-cli

Version:

Simple CLI wrapper for the CmpStr package to normalize and compare strings directly via terminal

42 lines (41 loc) 1.53 kB
/** * @fileoverview * Configuration utilities for CmpStr CLI * * Handles loading, merging, and resolving configuration from * YAML/JSON files and CLI options. * * @author Paul Köhler (komed3) * @license MIT */ import { type Command } from 'commander'; import type { Config } from './types.js'; /** * Loads a configuration file (YAML, YML, or JSON). * Falls back to the default config if no path is provided. * * @async * @param {string} [cfgPath] - Path to the config file. * @returns {Promise< Partial< Config > >} The loaded configuration object. * @throws {Error} If loading or parsing fails. */ export declare function loadCfg(cfgPath?: string): Promise<Partial<Config>>; /** * Loads and merges configuration from file and CLI options. * * @async * @param {Partial< Config >} [cfg] - The base config object (e.g., from CLI). * @param {string} [cfgPath] - Path to the config file. * @returns {Promise< Partial< Config > >} The resolved configuration object. */ export declare function resolveCfg(cfg?: Partial<Config>, cfgPath?: string): Promise<Partial<Config>>; /** * Resolves the effective configuration for a command. * Merges global options, command options, and config file. * * @async * @param {Command} cmd - The Commander command instance. * @param {Record< string, any >} [opt] - Additional options to merge. * @returns {Promise< Partial< Config > >} The resolved configuration object. */ export declare function cfg(cmd: Command, opt?: Record<string, any>): Promise<Partial<Config>>;