argparse-ts
Version:
Modern CLI arguments parser for node.js
59 lines (58 loc) • 1.57 kB
TypeScript
/**
* Base error class for all exceptions thrown by `ArgsParser`.
*
* @category Exceptions
*/
export declare class ArgsParserException extends Error {
readonly names: string[];
constructor(message?: string);
}
/**
* Base error class for all errors thrown by `ArgsParser`.
*
* @category Exceptions
*/
export declare class ArgsParserError extends ArgsParserException {
constructor(message?: string);
}
/**
* Thrown when trying to add an argument with a name that already exists.
*
* @category Exceptions
*/
export declare class ArgumentConfigError extends ArgsParserError {
constructor(message?: string);
}
/**
* Thrown when the argument name is invalid.
*
* @category Exceptions
*/
export declare class ArgumentNameError extends ArgsParserError {
constructor(message?: string);
}
/**
* Thrown when the argument value is invalid.
*
* @category Exceptions
*/
export declare class ArgumentValueError extends ArgsParserError {
constructor(message?: string);
}
/**
* Thrown when the parser should stop processing arguments.
*
* @category Exceptions
*/
export declare class StopException extends ArgsParserException {
constructor(message?: string);
}
/**
* Checks if the given exception is an instance of the specified class.
*
* @param e - The exception to check.
* @param instanceOf - The class to check against.
*
* @returns `true` if the exception is an instance of the specified class, `false` otherwise.
*/
export declare function isExceptionInstanceOf(e: unknown, instanceOf: typeof ArgsParserException): boolean;