@adonisjs/ace
Version:
Commandline apps framework used by AdonisJs
38 lines (37 loc) • 956 B
JavaScript
;
/*
* @adonisjs/ace
*
* (c) Harminder Virk <virk@adonisjs.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.args = void 0;
/**
* Adds arg to the list of command arguments with pre-defined
* type.
*/
function addArg(type, options) {
return function arg(target, propertyName) {
const Command = target.constructor;
Command.boot();
Command.$addArgument(Object.assign({ type, propertyName }, options));
};
}
exports.args = {
/**
* Define argument that accepts string value
*/
string(options) {
return addArg('string', options || {});
},
/**
* Define argument that accepts multiple values. Must be
* the last argument.
*/
spread(options) {
return addArg('spread', options || {});
},
};