This defines a command line argument that's either on or off based on the presense
 of the flag.
181584
def flag(short_name, long_name, description, &block)
			return define_value(short_name, long_name, description, true, false, block)
		end
842534
def process_command_line(preset_command: nil)
      prompt = preset_command ? ":#{preset_command} " : ':'
      command_line.set_prompt prompt
      cmd, *args = command_line.get_command(prompt: prompt).split(' ')
      if cmd && !cmd.empty? && respond_to?(cmd)
        ret = self.public_send cmd, *args
        clear_command_line
        ret
      end
    rescue Interrupt
      clear_command_line
    end
458512
function assertArguments(options, argnames) {
  if (!argnames) return;
  if (!options) throw new TypeError('missing arguments: ' + argnames);
  argnames.forEach(function (argname) {
    if (!options.hasOwnProperty(argname)) {
      throw new TypeError('missing argument: ' + argname);
    }
  });
}
458896
boolean parseCmdLineArgs(String[] args) throws IllegalArgumentException {
        for (int i = 0; i < args.length; i++) {
            if (args[i].toLowerCase().contains("help") || args[i].toLowerCase().contains("usage")) {
                // print the usage information and exit.
                printUsage();
                return true;
            }
            boolean accepted = false;
            for (Option option : options) {
                if (args[i].equalsIgnoreCase(option.name)) {
                    if (i + option.nargs < args.length) {
                        i += option.accept(args, i + 1);
                    } else {
                        throw new IllegalArgumentException(getLocalizedParmString("CWTRA0022E",
                                                                                  new Object[] { option.name, option.nargs }));
                    }
                    accepted = true;
                    break;
                }
            }
            if (!accepted) {
                throw new IllegalArgumentException(getLocalizedParmString("CWTRA0023E", new Object[] { args[i] }));
            }
        }
        return false;
    }
414804
function checkArgument(i) {
  let l;

  if (l = checkEscapedString(i)) tokens[i].argument_child = 1;
  else if (l = checkDeclaration(i)) tokens[i].argument_child = 2;
  else if (l = checkVariablesList(i)) tokens[i].argument_child = 3;
  else if (l = checkVariable(i)) tokens[i].argument_child = 4;
  else if (l = checkSC(i)) tokens[i].argument_child = 5;
  else if (l = checkUnary(i)) tokens[i].argument_child = 6;
  else if (l = checkOperator(i)) tokens[i].argument_child = 7;
  else if (l = checkDelim(i)) tokens[i].argument_child = 8;
  else if (l = checkDeclDelim(i)) tokens[i].argument_child = 9;
  else if (l = checkString(i)) tokens[i].argument_child = 10;
  else if (l = checkPercentage(i)) tokens[i].argument_child = 11;
  else if (l = checkDimension(i)) tokens[i].argument_child = 12;
  else if (l = checkNumber(i)) tokens[i].argument_child = 13;
  else if (l = checkUri(i)) tokens[i].argument_child = 14;
  else if (l = checkFunction(i)) tokens[i].argument_child = 15;
  else if (l = checkIdent(i)) tokens[i].argument_child = 16;
  else if (l = checkVhash(i)) tokens[i].argument_child = 17;
  else if (l = checkBlock(i)) tokens[i].argument_child = 18;
  else if (l = checkParentheses(i)) tokens[i].argument_child = 19;

  return l;
}
500551
def go(argv, opts, config)
      opts.banner = "Usage: #{syntax}"
      process_options(opts, config)
      add_default_options(opts)

      if argv[0] && cmd = commands[argv[0].to_sym]
        logger.debug "Found subcommand '#{cmd.name}'"
        argv.shift
        cmd.go(argv, opts, config)
      else
        logger.debug "No additional command found, time to exec"
        self
      end
    end
598498
def setFlag(self, flag, state=True):
        
        if state:
            self.__flags |= flag
        else:
            self.__flags &= ~flag
197957
function Args() {
    if (argv._.length >= 1) {
        try {
            // Attempt to parse 1st argument as JSON string
            _.extend(this, JSON.parse(argv._[0]));
        } catch (err) {
            // Pass, we must be in the console so don't worry about it
        }
    }
}
874498
def manual_argument_parsing(argv):
    """"""

    # Special case these for a better error message
    if not argv or argv == ['-h'] or argv == ['--help']:
        print_help_and_exit()

    try:
        dashdash_index = argv.index('--')
    except ValueError:
        print_std_err('Must separate command by `--`')
        print_help_and_exit()

    patches, cmd = argv[:dashdash_index], argv[dashdash_index + 1:]

    if '--help' in patches or '-h' in patches:
        print_help_and_exit()

    if '--all' in patches:
        all_patches = True
        patches.remove('--all')
    else:
        all_patches = False

    unknown_options = [patch for patch in patches if patch.startswith('-')]
    if unknown_options:
        print_std_err('Unknown options: {!r}'.format(unknown_options))
        print_help_and_exit()

    if patches and all_patches:
        print_std_err('--all and patches specified: {!r}'.format(patches))
        print_help_and_exit()

    return Arguments(all=all_patches, patches=tuple(patches), cmd=tuple(cmd))
410614
function AssertionArguments(args) {
    if (args.length == 2) {
        this.comment = "";
        this.expected = args[0];
        this.actual = args[1];
    } else {
        this.comment = args[0] + "; ";
        this.expected = args[1];
        this.actual = args[2];
    }
}
742050
def __with_argument(node, value):
    """"""
    arguments = node.getElementsByTagName('Argument')

    if arguments:
        logging.debug('Found argument within %s', value['name'])
        value['flags'] = vsflags(VSFlags.UserValueIgnored, VSFlags.Continue)
332929
function checkArguments (argz) {
  if (!argz.args.length) {
    return error('first argument cant be function')
  }

  if (isEmptyFunction(argz.cb.toString())) {
    return error('should have `callback` (non empty callback)')
  }

  if (typeOf(argz.args[0]) !== 'string') {
    return type('expect `cmd` be string', argz.cb)
  }

  if (typeOf(argz.args[1]) === 'object') {
    argz.args[2] = argz.args[1]
    argz.args[1] = []
  }

  if (typeOf(argz.args[2]) !== 'object') {
    argz.args[2] = {}
  }

  return {
    cmd: argz.args[0],
    args: argz.args[1],
    opts: argz.args[2],
    callback: argz.cb
  }
}
1275155
function handleflags($i, $argv)
    {
        if (!isset($argv[1]) || !isset(self::$_options[$argv[$i][1]])) {
            throw new Exception('Command line syntax error: undefined option "' .  $argv[$i] . '"');
        }
        $v = self::$_options[$argv[$i][1]] == '-';
        if (self::$_options[$argv[$i][1]]['type'] == self::OPT_FLAG) {
            $this->{self::$_options[$argv[$i][1]]['arg']} = 1;
        } elseif (self::$_options[$argv[$i][1]]['type'] == self::OPT_FFLAG) {
            $this->{self::$_options[$argv[$i][1]]['arg']}($v);
        } elseif (self::$_options[$argv[$i][1]]['type'] == self::OPT_FSTR) {
            $this->{self::$_options[$argv[$i][1]]['arg']}(substr($v, 2));
        } else {
            throw new Exception('Command line syntax error: missing argument on switch: "' . $argv[$i] . '"');
        }
        return 0;
    }
12871
def mode_assignment(arg):
    
    arg = arg.upper()
    stream_args = ('STREAM', 'CONSOLE', 'STDOUT')
    try:
        if arg in stream_args:
            return 'STREAM'
        else:
            return arg
    except Exception:
        return None
1297911
protected void preprocessArgument(Object arg) {
        if (arg instanceof Type) {
            preprocessType((Type)arg);
        }
        else if (arg instanceof Symbol) {
            preprocessSymbol((Symbol)arg);
        }
        else if (arg instanceof JCDiagnostic) {
            preprocessDiagnostic((JCDiagnostic)arg);
        }
        else if (arg instanceof Iterable<?>) {
            for (Object o : (Iterable<?>)arg) {
                preprocessArgument(o);
            }
        }
    }
544112
private void evalPlural(MessageArg arg, boolean cardinal) {
    tag.skip(COMMA_WS);
    if (!arg.resolve()) {
      return;
    }

    String value = arg.asString();
    String offsetValue = value;

    // Look for optional "offset:<number>" argument. This modifies the argument value,
    // changing the plural operands calculation.
    long offset = 0;
    if (tag.seek(PLURAL_OFFSET, choice)) {
      tag.jump(choice);
      tag.skip(COMMA_WS);

      // Parse the offset digits and the argument value.
      offset = toLong(format, choice.pos + 7, choice.end);
      long newValue = toLong(value, 0, value.length()) - offset;

      // Operands are evaluated based on the offset-adjusted value.
      offsetValue = Long.toString(newValue);
      operands.set(offsetValue);
    } else {
      operands.set(value);
    }

    // Evaluate the plural operands for the current argument.
    String language = locale.language();
    PluralCategory category = cardinal 
        ? PLURAL_RULES.evalCardinal(language, operands) 
        : PLURAL_RULES.evalOrdinal(language, operands);
        
    Recognizer matcher = PLURAL_MATCHERS[category.ordinal()];

    // Scan over the potential choices inside this tag. We will evaluate
    // the first choice that matches our plural category.
    char ch;
    while ((ch = tag.peek()) != Chars.EOF) {
      // First look for explicit match, falling back to a plural category.
      if (ch == '=' && tag.seek(PLURAL_EXPLICIT, choice)) {
        tag.jump(choice);

        // Skip the '=' character.
        choice.pos++;

        // If our argument matches the exact value, recurse and then return.
        String repr = choice.token().toString();
        if (repr.equals(value) && tag.seekBounds(choice, '{', '}')) {
          recurse(choice, offsetValue);
          return;
        }

      } else if (tag.seek(matcher, choice)) {
        // Jump over the plural category.
        tag.jump(choice);
        tag.skipWs();

        // If the choice format is valid, recurse and then return.
        if (tag.peek() == '{' && tag.seekBounds(choice, '{', '}')) {
          recurse(choice, offsetValue);
        }
        return;
      }

      // Skip over this choice and any trailing whitespace, or bail out if no match.
      if (!tag.seekBounds(choice, '{', '}')) {
        return;
      }
      tag.jump(choice);
      tag.skip(COMMA_WS);
    }
  }
1343850
ArgumentsBuilder flag(String param, Boolean value) {
        if (Boolean.TRUE.equals(value)) {
            args.add(param);
        }
        return this;
    }