@cloud-copilot/cli
Version:
A standardized library for CLI building TypeScript CLI applications
25 lines • 958 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.booleanArgument = booleanArgument;
/**
* 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
*/
function booleanArgument(options) {
return {
description: options.description,
character: options.character,
validateValues: (currentValue, value, isCurrentlyDefaulted) => {
if (value.length == 0) {
return { valid: true, value: true };
}
return { valid: false, message: `does not accept values but received ${value.join(', ')}` };
},
reduceValues: (current, newValue, isCurrentlyDefaulted) => current,
present: (currentValue) => true,
defaultValue: false
};
}
//# sourceMappingURL=booleanArgument.js.map