Lines Matching refs:arg
65 is(arg) { argument
66 return this.short === arg || this.long === arg;
307 args.forEach((arg) => {
314 switch (arg[0]) {
317 argDetails.name = arg.slice(1, -1);
320 argDetails.name = arg.slice(1, -1);
332 this._args.forEach((arg, i) => {
333 if (arg.variadic && i < this._args.length - 1) {
334 throw new Error(`only the last argument can be variadic '${arg.name}'`);
584 allowUnknownOption(arg) { argument
585 this._allowUnknownOption = (arg === undefined) || arg;
906 this._args.forEach((arg, i) => {
907 if (arg.required && args[i] == null) {
908 this.missingArgument(arg.name);
909 } else if (arg.variadic) {
951 _findOption(arg) { argument
952 return this.options.find(option => option.is(arg));
996 function maybeOption(arg) { argument
997 return arg.length > 1 && arg[0] === '-';
1002 const arg = args.shift();
1005 if (arg === '--') {
1006 if (dest === unknown) dest.push(arg);
1011 if (maybeOption(arg)) {
1012 const option = this._findOption(arg);
1034 if (arg.length > 2 && arg[0] === '-' && arg[1] !== '-') {
1035 const option = this._findOption(`-${arg[1]}`);
1039 this.emit(`option:${option.name()}`, arg.slice(2));
1043 args.unshift(`-${arg.slice(2)}`);
1050 if (/^--[^=]+=/.test(arg)) {
1051 const index = arg.indexOf('=');
1052 const option = this._findOption(arg.slice(0, index));
1054 this.emit(`option:${option.name()}`, arg.slice(index + 1));
1060 if (arg.length > 1 && arg[0] === '-') {
1065 dest.push(arg);
1270 const args = this._args.map((arg) => {
1271 return humanReadableArgName(arg);
1307 const args = cmd._args.map((arg) => {
1308 return humanReadableArgName(arg);
1366 return this._args.reduce((max, arg) => {
1367 return Math.max(max, arg.name.length);
1481 this._args.forEach((arg) => {
1482 …desc.push(' ' + pad(arg.name, width) + ' ' + wrap(argsDescription[arg.name], descriptionWidth, w…
1687 const helpOption = args.find(arg => arg === cmd._helpLongFlag || arg === cmd._helpShortFlag);
1703 function humanReadableArgName(arg) { argument
1704 const nameOutput = arg.name + (arg.variadic === true ? '...' : '');
1706 return arg.required
1724 return args.map((arg) => {
1725 let result = arg;
1726 if (arg.indexOf('--inspect') === 0) {
1731 if ((match = arg.match(/^(--inspect(-brk)?)$/)) !== null) {
1734 } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+)$/)) !== null) {
1743 } else if ((match = arg.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/)) !== null) {