index.js
function eatNargs (i, key, args) {
    var ii
    const toEat = checkAllAliases(key, flags.nargs)

    // nargs will not consume flag arguments, e.g., -abc, --foo,
    // and terminates when one is observed.
    var available = 0
    for (ii = i + 1; ii < args.length; ii++) {
      if (!args[ii].match(/^-[^0-9]/)) available++
      else break
    }

    if (available < toEat) error = Error(__('Not enough arguments following: %s', key))

    const consumed = Math.min(available, toEat)
    for (ii = i + 1; ii < (consumed + i + 1); ii++) {
      setArg(key, args[ii])
    }

    return (i + consumed)
  }
function eatNargs (i, key, args) {
    var ii
    const toEat = checkAllAliases(key, flags.nargs)

    // nargs will not consume flag arguments, e.g., -abc, --foo,
    // and terminates when one is observed.
    var available = 0
    for (ii = i + 1; ii < args.length; ii++) {
      if (!args[ii].match(/^-[^0-9]/)) available++
      else break
    }

    if (available < toEat) error = Error(__('Not enough arguments following: %s', key))

    const consumed = Math.min(available, toEat)
    for (ii = i + 1; ii < (consumed + i + 1); ii++) {
      setArg(key, args[ii])
    }

    return (i + consumed)
  }
function eatNargs ( i , key , args ) { var ii const toEat = checkAllAliases ( key , flags . nargs ) // nargs will not consume flag arguments, e.g., -abc, --foo, // and terminates when one is observed. var available = 0 for ( ii = i + 1 ; ii < args . length ; ii ++ ) { if ( ! args [ ii ] . match ( / ^-[^0-9] / ) ) available ++ else break } if ( available < toEat ) error = Error ( __ ( 'Not enough arguments following: %s' , key ) ) const consumed = Math . min ( available , toEat ) for ( ii = i + 1 ; ii < ( consumed + i + 1 ) ; ii ++ ) { setArg ( key , args [ ii ] ) } return ( i + consumed ) }
how many arguments should we consume, based on the nargs option?
how many arguments should we consume based on the nargs option?