common/process/cli.js
function gotOption (option) {
    if (map[option]) {
      option = map[option]
      var name = option[0]
      // Assume a boolean, and set to true because the argument is present.
      var value = true
      // If it takes arguments, override with a value.
      var count = option[2]
      while (count--) {
        value = argv[++index]
        if (argv.length === index) {
          return cli.error('The "' + name + '" option requires an argument.')
        }
      }
      // If it needs type conversion, do it.
      var type = option[1]
      if (type === 'Array') {
        value = value.split(',')
      } else if (type === 'RegExp') {
        try {
          value = new RegExp(value)
        } catch (e) {
          return cli.error('The "' + name + '" option received an invalid expression: "' + value + '".')
        }
      } else if (type === 'Number') {
        var number = value * 1
        if (isNaN(number)) {
          return cli.error('The "' + name + '" option received a non-numerical argument: "' + value + '".')
        }
      }
      args[name] = value
    } else {
      return cli.error('Unknown option: "' + option + '".')
    }
  }
function gotOption (option) {
    if (map[option]) {
      option = map[option]
      var name = option[0]
      // Assume a boolean, and set to true because the argument is present.
      var value = true
      // If it takes arguments, override with a value.
      var count = option[2]
      while (count--) {
        value = argv[++index]
        if (argv.length === index) {
          return cli.error('The "' + name + '" option requires an argument.')
        }
      }
      // If it needs type conversion, do it.
      var type = option[1]
      if (type === 'Array') {
        value = value.split(',')
      } else if (type === 'RegExp') {
        try {
          value = new RegExp(value)
        } catch (e) {
          return cli.error('The "' + name + '" option received an invalid expression: "' + value + '".')
        }
      } else if (type === 'Number') {
        var number = value * 1
        if (isNaN(number)) {
          return cli.error('The "' + name + '" option received a non-numerical argument: "' + value + '".')
        }
      }
      args[name] = value
    } else {
      return cli.error('Unknown option: "' + option + '".')
    }
  }
function gotOption ( option ) { if ( map [ option ] ) { option = map [ option ] var name = option [ 0 ] // Assume a boolean, and set to true because the argument is present. var value = true // If it takes arguments, override with a value. var count = option [ 2 ] while ( count -- ) { value = argv [ ++ index ] if ( argv . length === index ) { return cli . error ( 'The "' + name + '" option requires an argument.' ) } } // If it needs type conversion, do it. var type = option [ 1 ] if ( type === 'Array' ) { value = value . split ( ',' ) } else if ( type === 'RegExp' ) { try { value = new RegExp ( value ) } catch ( e ) { return cli . error ( 'The "' + name + '" option received an invalid expression: "' + value + '".' ) } } else if ( type === 'Number' ) { var number = value * 1 if ( isNaN ( number ) ) { return cli . error ( 'The "' + name + '" option received a non-numerical argument: "' + value + '".' ) } } args [ name ] = value } else { return cli . error ( 'Unknown option: "' + option + '".' ) } }
Handle the event of an option being seen.
Handle the event of an option being seen .