Checks a command argument.
349785
private State checkArg(char command, String arg, State state)
            throws DatatypeException, IOException {
        int mant = 0;
        int mantDig = 0;
        boolean mantPos = true;
        boolean mantRead = false;

        int exp = 0;
        int expDig = 0;
        int expAdj = 0;
        boolean expPos = true;

        switch (state.current) {
            case '-':
                mantPos = false;
            case '+':
                state.current = state.reader.read();
                state = appendToContext(state);
        }

        m1: switch (state.current) {
            default:
                reportUnexpected(
                        arg + " for \u201c" + command + "\u201d command",
                        state.current, state.context);
                state = skipSubPath(state);
                return state;

            case '.':
                break;

            case '0':
                mantRead = true;
                l: for (;;) {
                    state.current = state.reader.read();
                    state = appendToContext(state);
                    switch (state.current) {
                        case '1':
                        case '2':
                        case '3':
                        case '4':
                        case '5':
                        case '6':
                        case '7':
                        case '8':
                        case '9':
                            break l;
                        case '.':
                        case 'e':
                        case 'E':
                            break m1;
                        default:
                            return state;
                        case '0':
                    }
                }

            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                mantRead = true;
                l: for (;;) {
                    if (mantDig < 9) {
                        mantDig++;
                        mant = mant * 10 + (state.current - '0');
                    } else {
                        expAdj++;
                    }
                    state.current = state.reader.read();
                    state = appendToContext(state);
                    switch (state.current) {
                        default:
                            break l;
                        case '0':
                        case '1':
                        case '2':
                        case '3':
                        case '4':
                        case '5':
                        case '6':
                        case '7':
                        case '8':
                        case '9':
                    }
                }
        }

        if (state.current == '.') {
            state.current = state.reader.read();
            state = appendToContext(state);
            m2: switch (state.current) {
                default:
                case 'e':
                case 'E':
                    if (!mantRead) {
                        reportNonNumber(command, state.current, state.context);
                        return state;
                    }
                    break;

                case '0':
                    if (mantDig == 0) {
                        l: for (;;) {
                            state.current = state.reader.read();
                            state = appendToContext(state);
                            expAdj--;
                            switch (state.current) {
                                case '1':
                                case '2':
                                case '3':
                                case '4':
                                case '5':
                                case '6':
                                case '7':
                                case '8':
                                case '9':
                                    break l;
                                default:
                                    if (!mantRead) {
                                        return state;
                                    }
                                    break m2;
                                case '0':
                            }
                        }
                    }
                case '1':
                case '2':
                case '3':
                case '4':
                case '5':
                case '6':
                case '7':
                case '8':
                case '9':
                    l: for (;;) {
                        if (mantDig < 9) {
                            mantDig++;
                            mant = mant * 10 + (state.current - '0');
                            expAdj--;
                        }
                        state.current = state.reader.read();
                        state = appendToContext(state);
                        switch (state.current) {
                            default:
                                break l;
                            case '0':
                            case '1':
                            case '2':
                            case '3':
                            case '4':
                            case '5':
                            case '6':
                            case '7':
                            case '8':
                            case '9':
                        }
                    }
            }
        }

        switch (state.current) {
            case 'e':
            case 'E':
                state.current = state.reader.read();
                state = appendToContext(state);
                switch (state.current) {
                    default:
                        reportNonNumber(command, state.current, state.context);
                        return state;
                    case '-':
                        expPos = false;
                    case '+':
                        state.current = state.reader.read();
                        state = appendToContext(state);
                        switch (state.current) {
                            default:
                                reportNonNumber(command, state.current,
                                        state.context);
                                return state;
                            case '0':
                            case '1':
                            case '2':
                            case '3':
                            case '4':
                            case '5':
                            case '6':
                            case '7':
                            case '8':
                            case '9':
                        }
                    case '0':
                    case '1':
                    case '2':
                    case '3':
                    case '4':
                    case '5':
                    case '6':
                    case '7':
                    case '8':
                    case '9':
                }

                en: switch (state.current) {
                    case '0':
                        l: for (;;) {
                            state.current = state.reader.read();
                            state = appendToContext(state);
                            switch (state.current) {
                                case '1':
                                case '2':
                                case '3':
                                case '4':
                                case '5':
                                case '6':
                                case '7':
                                case '8':
                                case '9':
                                    break l;
                                default:
                                    break en;
                                case '0':
                            }
                        }

                    case '1':
                    case '2':
                    case '3':
                    case '4':
                    case '5':
                    case '6':
                    case '7':
                    case '8':
                    case '9':
                        l: for (;;) {
                            if (expDig < 3) {
                                expDig++;
                                exp = exp * 10 + (state.current - '0');
                            }
                            state.current = state.reader.read();
                            state = appendToContext(state);
                            switch (state.current) {
                                default:
                                    break l;
                                case '0':
                                case '1':
                                case '2':
                                case '3':
                                case '4':
                                case '5':
                                case '6':
                                case '7':
                                case '8':
                                case '9':
                            }
                        }
                }
            default:
        }

        if (!expPos) {
            exp = -exp;
        }
        exp += expAdj;
        if (!mantPos) {
            mant = -mant;
        }
        return state;
    }
889934
private static void checkArguments(final Object... args) {
        for (Object o : args) {
            if (o == null) {
                throw new NullPointerException("argument can not be null " + Arrays.toString(args));
            }
        }
    }
1313424
def check_arguments(self):
        """"""
        for name, default in self.argdict.items():
            if name not in self.names and default is NODEFAULT:
                raise NameError('Missing argparse specification for %r' % name)
1279771
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);
  var sub = info.command.sub
    , scmd = ('' + sub.cmd)
    , args = sub.args
    , amount;

  if(scmd === Constants.SUBCOMMAND.slowlog.get.name && args.length) {
    if(args.length > 1) {
      throw new CommandArgLength(cmd, scmd);
    }
    amount = parseInt('' + args[0]);
    if(isNaN(amount)) {
      throw IntegerRange;
    }
    args[0] = amount;
  }
}
626140
def check_args(self):
        
        parser = get_base_arguments(get_parser())
        parser = get_tc_arguments(parser)
        # Disable "Do not use len(SEQ) as condition value"
        # pylint: disable=C1801
        if len(sys.argv) < 2:
            self.logger.error("Icetea called with no arguments! ")
            parser.print_help()
            return False
        elif not self.args.ignore_invalid_params and self.unknown:
            self.logger.error("Unknown parameters received, exiting. "
                              "To ignore this add --ignore_invalid_params flag.")
            self.logger.error("Following parameters were unknown: {}".format(self.unknown))
            parser.print_help()
            return False
        return True
1265622
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);
  var value = parseInt('' + args[2]);
  if(value !== 0 && value !== 1) throw InvalidBit;
  args[2] = value;
}
1223981
public static void checkNumOfArgsEquals(Command cmd, CommandLine cl, int n) throws
      InvalidArgumentException {
    if (cl.getArgs().length != n) {
      throw new InvalidArgumentException(ExceptionMessage.INVALID_ARGS_NUM
          .getMessage(cmd.getCommandName(), n, cl.getArgs().length));
    }
  }
209163
def _validate_argument(self, arg):
        """"""
        if arg is None:
            return arg

        if isinstance(arg, type):
            return InstanceOf(arg)
        if not isinstance(arg, BaseMatcher):
            raise TypeError(
                "argument of %s can be a type or a matcher (got %r)" % (
                    self.__class__.__name__, type(arg)))

        return arg
701690
def _check_arguments(self):
        """"""
        if self.argument_checked:
            return

        assert(self.symbol is not None)
        self.argument_checked = True

        # check if symbol contain duplicated names.
        _check_arguments(self.symbol)
        # rematch parameters to delete useless ones
        if self.allow_extra_params:
            if self.arg_params:
                arg_names = set(self.symbol.list_arguments())
                self.arg_params = {k : v for k, v in self.arg_params.items()
                                   if k in arg_names}
            if self.aux_params:
                aux_names = set(self.symbol.list_auxiliary_states())
                self.aux_params = {k : v for k, v in self.aux_params.items()
                                   if k in aux_names}
807744
function checkForUnknownArguments(yargs, argv, command) {
	const aliasLookup = {};
	const flags = yargs.getOptions().key;
	const demanded = yargs.getDemanded();
	const unknown = [];

	Object.keys(yargs.parsed.aliases || {}).forEach((key) => {
		yargs.parsed.aliases[key].forEach((alias) => {
			aliasLookup[alias] = key;
		});
	});

	function isUnknown(key) {
		return (key !== '$0' && key !== '_' && key !== 'params' &&
			!demanded.hasOwnProperty(key) &&
			!flags.hasOwnProperty(key) &&
			!aliasLookup.hasOwnProperty('no-' + key) &&
			!aliasLookup.hasOwnProperty(key));
	}

	function aliasFor(key) {
		return command.unaliasOption(key);
	}

	Object.keys(argv).forEach((key) => {
		const alias = aliasFor(key);
		if (isUnknown(key) && (!alias || isUnknown(alias))) {
			unknown.push(key);
		}
	});

	if (unknown.length) {
		throw unknownArgumentError(unknown);
	}
}
946717
def check_command(self, command):
        

        # Use `command` to see if command is callable, store exit code
        code = os.system("command -v {0} >/dev/null 2>&1 || {{ exit 1; }}".format(command))

        # If exit code is not 0, report which command failed and return False, else return True
        if code != 0:
            print("Command is not callable: {0}".format(command))
            return False
        else:
            return True
1264354
def validate(self, cmd, messages=None):
        
        valid = True
        args  = [ arg for arg in cmd.args if arg is not None ]

        if self.nargs != len(args):
            valid = False
            if messages is not None:
                msg  = 'Expected %d arguments, but received %d.'
                messages.append(msg % (self.nargs, len(args)))

        for defn, value in zip(self.args, cmd.args):
            if value is None:
                valid = False
                if messages is not None:
                    messages.append('Argument "%s" is missing.' % defn.name)
            elif defn.validate(value, messages) is False:
                valid = False

        if len(cmd._unrecognized) > 0:
            valid = False
            if messages is not None:
                for name in cmd.unrecognized:
                    messages.append('Argument "%s" is unrecognized.' % name)

        return valid
1148929
def _check(self, args):
        """"""
        if sum(bool(args[arg]) for arg in self._mapping) > 1:
            raise DocoptExit(_('These options are mutually exclusive: {0}',
                               ', '.join(self._mapping)))
535846
def _check_cmd(call):
    '''
    
    '''
    if call['retcode'] != 0:
        comment = ''
        std_err = call.get('stderr')
        std_out = call.get('stdout')
        if std_err:
            comment += std_err
        if std_out:
            comment += std_out

        raise CommandExecutionError('Error running command: {0}'.format(comment))

    return call
1044869
private void checkArgument(boolean argument, String msg, Object... args) {
        if (!argument) {
            throw new IllegalArgumentException(String.format(msg, args));
        }
    }
761646
public function checkArguments()
    {
        $argc = count($this->args);

        $req = 0;
        foreach ($this->setup[$this->command]['args'] as $arg) {
            if (!$arg['required']) {
                break;
            } // last required arguments seen
            $req++;
        }

        if ($req > $argc) {
            throw new Exception("Not enough arguments", Exception::E_OPT_ARG_REQUIRED);
        }
    }
795246
def check_argument_size(args)
      if @command.numerical_arg_size? && args.size != @command.arg_size
        command_size, args_size = args.size > @command.arg_size ?
          [@command.arg_size, args.size] :
          [@command.arg_size - 1, args.size - 1]
        raise CommandArgumentError,
          "wrong number of arguments (#{args_size} for #{command_size})"
      end
    end