validates command line arguments
172908
static void validateStartupOptions(StartupInfo startInfo) throws IOException {
    // sync cannot be specified along with format or finalize
    if (startInfo.isStandby) {
      if (startInfo.startOpt == StartupOption.FORMAT ||
          startInfo.startOpt == StartupOption.FINALIZE ||
          startInfo.startOpt == StartupOption.ROLLBACK ||
          startInfo.startOpt == StartupOption.UPGRADE) {
        throw new IOException("Standby avatar node cannot be started with " +
          startInfo.startOpt + " option.");
      }
    }
  }
808939
function validate(string $value, \CharlotteDunois\Livia\Commands\Context $context, ?\CharlotteDunois\Livia\Arguments\Argument $arg = null) {
        $value = \mb_strtolower($value);
        return (\in_array($value, $this->truthy) || \in_array($value, $this->falsey));
    }
88893
def validate_input(dest, args)
      return true unless should_validate(dest)
      @input.each do |p|
        val = args[p[:symbol]]
      
        # if the argument has a value, no need to test whether it is optional.
        next unless !val || val == '*' || val == ''
      
        opts = p[:opts]
        unless opts[:optional]
          raise ArgumentError, "You must specify the required input #{p[:symbol]}"
        end
      end
      return true
    end
1179817
def validate(args):
    
    if args.format not in FORMATTERS:
        print(
            "Subtitle format not supported. "
            "Run with --list-formats to see all supported formats."
        )
        return False

    if args.src_language not in LANGUAGE_CODES.keys():
        print(
            "Source language not supported. "
            "Run with --list-languages to see all supported languages."
        )
        return False

    if args.dst_language not in LANGUAGE_CODES.keys():
        print(
            "Destination language not supported. "
            "Run with --list-languages to see all supported languages."
        )
        return False

    if not args.source_path:
        print("Error: You need to specify a source path.")
        return False

    return True
851099
def validate_file(parser, arg):
    """"""
    if not os.path.isfile(arg):
        parser.error("%s is not a file." % arg)
    return arg
1227592
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);
  var sub = info.command.sub
    , cmd = '' + sub.cmd
    , args = sub.args
    , key
    , val
    , verified;

  if(cmd === Constants.SUBCOMMAND.config.set.name) {
    key = '' + args[0];
    val = '' + args[1];

    // test config key is allowed to be set at runtime
    if(!~Runtime.indexOf(key)) {
      throw new ConfigParameter(key);
    }

    // validate input value and coerce to native type
    try {
      val = this.conf.validate(key, [val]);

      // additional validation after type coercion and
      // basic checks, some methods modify the value (hz)
      // although most just throw an error
      verified = this.conf.verify(key, val);
      if(verified !== undefined) {
        val = verified;
      }
      args[1] = val;
    }catch(e) {
      throw new ConfigValue(key, val);
    }
  }else if(cmd === Constants.SUBCOMMAND.config.rewrite.name) {
    if(this.conf.isDefault()) {
      throw ConfigRewrite;
    }
  }
}
590929
def validate_args(opts):
    """"""
    if opts['--wide'] is None:
        opts['--wide'] = 2
    else:
        assert opts['--wide'] in ("1", "2"), opts['--wide']
    if opts['--alignment'] is None:
        opts['--alignment'] = 'left'
    else:
        assert opts['--alignment'] in ('left', 'right'), opts['--alignment']
    opts['--wide'] = int(opts['--wide'])
    opts['character_factory'] = WcWideCharacterGenerator
    if opts['--combining']:
        opts['character_factory'] = WcCombinedCharacterGenerator
    return opts
1229728
function validate_op_args(raw_arg0, op, op_params) {
        const arg0 = undefined === raw_arg0
            ? ALL_ITEMS
            : raw_arg0
            ; // eslint-disable-line indent
        switch (true) {
            case ALL_ITEMS === arg0:
            case arg0 instanceof Query:
            case 'string' === typeof arg0:
            case 'number' === typeof arg0:
                if (op && 'string' !== typeof op) {
                    throw new Error([
                        'When calling a bullpen operation,',
                        'if arg 1 is provided, it must be',
                        'the name of the operation to perform',
                        ].join(' ')); // eslint-disable-line indent
                } else if (op_params && 'object' !== typeof op_params) {
                    throw new Error([
                        'When calling a bullpen operation,',
                        'if arg 2 is provided, it must be a params object',
                        ].join(' ')); // eslint-disable-line indent
                }
                return [ arg0, op, op_params ];
        }
        throw new Error([
            'When calling a bullpen operation, if args are provided,',
            'arg 0 of must be one of:',
            'a string, a number, COLLECTION.ALL_ITEMS, or',
            'an instance of COLLECTION.Query',
            ].join(' ')); // eslint-disable-line indent
    }
312974
def _validate_args(self, args):
        '''  '''
        assert(args.bucket)

        if args.subscribers:
            for _subscriber in args.subscribers:
                assert(isinstance(_subscriber, AsperaBaseSubscriber))

        if (args.transfer_config):
            assert(isinstance(args.transfer_config, AsperaConfig))

            # number of sessions requested cant be greater than max ascps
            if args.transfer_config.multi_session > self._config.ascp_max_concurrent:
                raise ValueError("Max sessions is %d" % self._config.ascp_max_concurrent)

        for _pair in args.file_pair_list:
            if not _pair.key or not _pair.fileobj:
                raise ValueError("Invalid file pair")
508200
def checkargs(self, lineno, command, args):
		
		for wanted, arg in zip(command.argtypes(), args):
			wanted = wanted.type_
			if(wanted == "register" and (not arg in self.register)):
				raise ArgumentError("[line {}]: Command '{}' wants argument of type register, but {} is not a register".format(lineno, command.mnemonic(), arg))
			if(wanted == "const" and (arg in self.register)):
				raise ArgumentError("[line {}]: Command '{}' wants argument of type const, but {} is a register.".format(lineno, command.mnemonic(), arg))
677657
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);
  if(!info.conn.transaction) {
    throw DiscardWithoutMulti;
  }
}
820234
public function validate(Args $args) {
        $isValid = true;
        $command = $args->getCommand();
        $valid = new Args($command);
        $schema = $this->getSchema($command);
        ksort($schema);

//        $meta = $schema[Cli::META];
        unset($schema[Cli::META]);
        $opts = $args->getOpts();
        $missing = [];

        // Check to see if the command is correct.
        if ($command && !$this->hasCommand($command) && $this->hasCommand()) {
            echo $this->red("Invalid command: $command.".PHP_EOL);
            $isValid = false;
        }

        // Add the args.
        $valid->setArgs($args->getArgs());

        foreach ($schema as $key => $definition) {
            // No Parameter (default)
            $type = Cli::val('type', $definition, 'string');

            if (array_key_exists($key, $opts)) {
                // Check for --key.
                $value = $opts[$key];
                if ($this->validateType($value, $type, $key, $definition)) {
                    $valid->setOpt($key, $value);
                } else {
                    $isValid = false;
                }
                unset($opts[$key]);
            } elseif (isset($definition['short']) && array_key_exists($definition['short'], $opts)) {
                // Check for -s.
                $value = $opts[$definition['short']];
                if ($this->validateType($value, $type, $key, $definition)) {
                    $valid->setOpt($key, $value);
                } else {
                    $isValid = false;
                }
                unset($opts[$definition['short']]);
            } elseif (array_key_exists('no-'.$key, $opts)) {
                // Check for --no-key.
                $value = $opts['no-'.$key];

                if ($type !== 'boolean') {
                    echo $this->red("Cannot apply the --no- prefix on the non boolean --$key.".PHP_EOL);
                    $isValid = false;
                } elseif ($this->validateType($value, $type, $key, $definition)) {
                    $valid->setOpt($key, !$value);
                } else {
                    $isValid = false;
                }
                unset($opts['no-'.$key]);
            } elseif ($definition['required']) {
                // The key was not supplied. Is it required?
                $missing[$key] = true;
                $valid->setOpt($key, false);
            }
        }

        if (count($missing)) {
            $isValid = false;
            foreach ($missing as $key => $v) {
                echo $this->red("Missing required option: $key".PHP_EOL);
            }
        }

        if (count($opts)) {
            $isValid = false;
            foreach ($opts as $key => $v) {
                echo $this->red("Invalid option: $key".PHP_EOL);
            }
        }

        if ($isValid) {
            return $valid;
        } else {
            echo PHP_EOL;
            return null;
        }
    }
319588
function validateArgs(args) {
    if (args.length === 0) {
      grunt.log.error('Unable to run task: no action specified (e.g. run or update)');
      return false;
    } else if (args.length === 1) {
      grunt.log.error('Unable to run task: no target specified');
      return false;
    } else if (args.length > 3) {
      grunt.log.error('Unable to run task: too many arguments (up to 4 allowed)');
      return false;
    }

    return true;
  }
283568
def check_args!
      ::Hash[@args.zip(::ARGV)].each do |arg_name,arg_value|
        if @arg_options[arg_name].include? :required
          if arg_value.nil?
            message = "'#{arg_name.to_s}' is required"
            message = "at least one " + message if @arg_options[arg_name].include? :many
            raise ::OptionParser::ParseError,message
          end
        end
      end
    end
1123274
def check_arguments(self):
        
        for k, v in self.Parameters.iteritems():
            if self.Parameters[k].isOn():
                if k in self._valid_arguments:
                    if not self._valid_arguments[k](v.Value):
                        error_message = 'Invalid argument (%s) ' % v.Value
                        error_message += 'for parameter %s\n' % k
                        raise InvalidArgumentApplicationError(error_message)
555399
def validate_args(self):
        """"""
        base.BaseTarget.validate_args(self)
        params = self.params
        if params['extra_control_fields'] is not None:
            assert isinstance(params['extra_control_fields'], list), (
                'extra_control_fields must be a list of tuples, not %s' % type(
                    params['extra_control_fields']))
            for elem in params['extra_control_fields']:
                assert (isinstance(elem, tuple) and len(elem) == 1), (
                    'extra_control_fields must be a list of 2-element tuples. '
                    'Invalid contents: %s' % elem)
        pkgname_re = '^[a-z][a-z0-9+-.]+'
        assert re.match(pkgname_re, params['package_name']), (
            'Invalid package name: %s. Must match %s' % (
                params['package_name'], pkgname_re))
27936
async function validateArguments(args, operation) {
    let error = new Error();
    let body = undefined;

    error.name = 'ArgumentError';
    if (!operation) {
        let verbs = ["add", "clone", "delete", "export", "package", "get", "import", "list", "publish", "query", "set", "suggest", "train", "update"];
        if (verbs.indexOf(args._[0]) < 0)
            error.message = `'${args._[0]}' is not a valid action`;
        else if (args._.length >= 2)
            error.message = `'${args._[1]}' is not a valid resource`;
        else
            error.message = `missing resource\n`;
        throw error;
    }

    switch (operation.target[0]){
        case "userazureaccounts":
        case "appazureaccounts":
            switch (operation.methodAlias) {
                case "list":
                    if (args.hasOwnProperty("armToken")) {
                        args.customHeaders["Authorization"] = `Bearer ${args.armToken}`;
                    }
                    break;
                }
                break;
                case "appazureaccount":
                    switch (operation.methodAlias) {
                        case "add":
                        case "delete":
                            if (args.hasOwnProperty("armToken")) {
                                args.customHeaders["Authorization"] = `Bearer ${args.armToken}`;
                            }
                            break;
                        }
                        break;
    }

    const entitySpecified = typeof args.in === 'string';
    const entityRequired = !!operation.entityName;

    if (entityRequired) {
        if (entitySpecified) {
            body = await getFileInput(args);
        }
        else {
            // make up a request body from command line args
            switch (operation.target[0]) {
                case "version":
                    switch (operation.methodAlias) {
                        case "publish":
                            if (args.versionId) {
                                body = {
                                    versionId: `${args.versionId}`,
                                    isStaging: args.staging === 'true'
                                };
                            }
                            break;
                        case "rename":
                        case "update":
                        case "clone":
                            if (args.newVersionId) {
                                body = {
                                    version: `${args.newVersionId}`
                                };
                            }
                            break;
                    }
                    break;

                case "settings":
                    switch (operation.methodAlias) {
                        case "update":
                            if (args.hasOwnProperty("public")) {
                                body = {
                                    isPublic: args.public === 'true'
                                };
                            }
                            break;
                    }
                    break;
                case "versionsettings":
                    switch (operation.methodAlias) {
                        case "update":
                            if (args.hasOwnProperty("useAllTrainingData")) {
                                body = [{
                                    name: "UseAllTrainingData",
                                    value: args.useAllTrainingData === 'true' ? 'true' : 'false'
                                }];
                            }
                            break;
                    }
                    break;
                case "appazureaccount":
                    if (args.azureSubscriptionId && args.resourceGroup && args.accountName) {
                        body = {
                            azureSubscriptionId: `${args.azureSubscriptionId}`,
                            resourceGroup: `${args.resourceGroup}`,
                            accountName: `${args.accountName}`
                        };
                    }
                    break;

                default:
                    error.message = `The --in requires an input of type: ${operation.entityType}`;
                    throw error;
            }
        }
    }
    return body;
    // Note that the ServiceBase will validate params that may be required.
}