@cloud-copilot/cli
Version:
A standardized library for CLI building TypeScript CLI applications
22 lines • 801 B
JavaScript
/**
* Creates a boolean argument that is false by default and true if present.
*
* @param options the description and the single character that can be used to set the value to true
* @returns a boolean argument
*/
export function booleanArgument(options) {
return {
description: options.description,
character: options.character,
validateValues: (currentValue, value) => {
if (value.length == 0) {
return { valid: true, value: true };
}
return { valid: false, message: `does not accept values but received ${value.join(', ')}` };
},
reduceValues: (current, newValue) => current,
present: (currentValue) => true,
defaultValue: false
};
}
//# sourceMappingURL=booleanArgument.js.map