UNPKG

@adonisjs/ace

Version:

Commandline apps framework used by AdonisJs

55 lines (54 loc) 1.37 kB
"use strict"; /* * @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.flags = void 0; /** * Pushes flag to the list of command flags with predefined * types. */ function addFlag(type, options) { return function flag(target, propertyName) { const Command = target.constructor; Command.boot(); Command.$addFlag(Object.assign({ type, propertyName }, options)); }; } exports.flags = { /** * Create a flag that excepts string values */ string(options) { return addFlag('string', options || {}); }, /** * Create a flag that excepts numeric values */ number(options) { return addFlag('number', options || {}); }, /** * Create a flag that excepts boolean values */ boolean(options) { return addFlag('boolean', options || {}); }, /** * Create a flag that excepts array of string values */ array(options) { return addFlag('array', options || {}); }, /** * Create a flag that excepts array of numeric values */ numArray(options) { return addFlag('numArray', options || {}); }, };