@thisismanta/pessimist
Version:
This is a Node.js library that helps derive `process.argv` into a first-hand-**TypeScript** value-strict object with very minimal configurations.
17 lines (16 loc) • 645 B
TypeScript
export declare function parseArguments<K extends string & keyof T, T = {
[key: string]: boolean | number | string | Array<string>;
}>(inputs: Array<string>, defaultHash: Readonly<T>, options?: Partial<{
/**
* A mapping of aliases to formal names.
* @example
* { d: 'dryRun', o: 'outFile' }
*/
aliases: Record<string, K | `!${K}`>;
/**
* A list of mutually exclusive argument groups. If more than one argument from the same group is present, an error will be thrown.
* @example
* [['dryRun', 'commit'], ['outFile', 'outDir']]
*/
exclusives: Array<Array<K>>;
}>): T & ArrayLike<string>;