Validate the given command.
 @param cmd [Array] only one command should be given.
 @return [String] extracts out of Array
767135
def validate_command(cmd = ARGV)
      fail 'Specify one action.' unless cmd.count == 1
      cmd = cmd.shift
      fail 'Invalid action.' unless SUB_COMMANDS.include?(cmd)
      cmd
    end
1245430
def process_command(command: CommandInput, matrix: VarMatrix) -> List[Command]:
    
    assert command is not None
    if isinstance(command, str):
        command_list = [Command(command, variables=variables) for variables in matrix]
    elif isinstance(command, list):
        command_list = [Command(command, variables=variables) for variables in matrix]
    else:
        if command.get("command") is not None:
            cmd = command.get("command")
        else:
            cmd = command.get("cmd")
        creates = str(command.get("creates", ""))
        requires = str(command.get("requires", ""))

        assert isinstance(cmd, (list, str))
        command_list = [
            Command(cmd, variables, creates, requires) for variables in matrix
        ]
    return uniqueify(command_list)
882717
function validateRequired(config, commandSpec) {
  var errors = '';
  
  if (commandSpec.parameters) {
    commandSpec.parameters.forEach(function(param) {
      if (param.required == true
      && (config[param.name] == '' || config[param.name] == []) ) {
        errors += 'Parameter ' + param.name + ' is required\n';
      }
    })
  }
  
  if (commandSpec.options) {
    for (var i=0;i<commandSpec.options.length;i++) {
      if (commandSpec.options[i].required
      && commandSpec.options[i].required == true
      && config.options[commandSpec.options[i].option] == '') {
        errors += 'Option ' + commandSpec.options[i].option + ' is required\n';
      }
    }
  }
  
  if (commandSpec.environment) {
    for (var i=0;i<commandSpec.environment.length;i++) {
      if (commandSpec.environment[i].required
      && commandSpec.environment[i].required == true
      && config.environment[commandSpec.environment[i].parameter] == '') {
        errors += 'Environment ' + commandSpec.environment[i].parameter + ' is required\n';
      }      
    }
  }
  
  if (errors != '') errors = errors.substring(0, errors.length-1);   //remove trailing newline
  return errors;
}
231636
def command=(com)

      com = com.is_a?(Array) ? com : com.split(' ')
      com = [ com.first, com.last ]
      com[1] = com[1].to_i if com[1] and com[0] != 'jump'

      h.fields['__command__'] = com
    end
1210580
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);
  var op = ('' + args[0]).toLowerCase();
  if(op !== BITOP.AND && op !== BITOP.OR
    && op !== BITOP.XOR && op !== BITOP.NOT) {
    throw CommandSyntax;
  }
  if(op === BITOP.NOT && args.length !== 3) {
    throw BitopNot;
  }
  args[0] = op;
}
598769
def runcmd
      @success = false
      @success = run
      logger.debug(@lastcall.inspect) unless @lastcall.nil? if logger
      logger.debug(@result) unless @result.nil? if logger
      @success
    end
586767
public static int validate(String... argv) throws InterruptedException {
    if (argv.length < 1) {
      printHelp("Target not specified.");
      return -2;
    }
    String command = argv[0];
    String name = null;
    String[] args;
    int argsLength = 0;
    // Find all non-option command line arguments.
    while (argsLength < argv.length && !argv[argsLength].startsWith("-")) {
      argsLength++;
    }
    if (argsLength > 1) {
      name = argv[1];
      args = Arrays.copyOfRange(argv, 2, argv.length);
    } else {
      args = Arrays.copyOfRange(argv, 1, argv.length);
    }

    CommandLine cmd;
    try {
      cmd = parseArgsAndOptions(OPTIONS, args);
    } catch (InvalidArgumentException e) {
      System.err.format("Invalid argument: %s.%n", e.getMessage());
      return -1;
    }
    if (command != null && command.equals("list")) {
      printTasks();
      return 0;
    }
    return runTasks(command, name, cmd);
  }
322158
def valid_args?(accepted_arg_formats)
      valid_args = false

      accepted_arg_formats.each { |format|
        # if no arguments exist, and no arguments is an accepted format, args are valid.
        if format.empty? && @current_args.empty?
          valid_args = true
        else
          passed_in_args = @current_args.clone

          format.each_with_index { |arg, i|
            passed_in_args[i] = arg if CMD_BLACKLIST.include?(arg)
          }

          @invalid_args = passed_in_args - format - [nil]

          valid_args = true if passed_in_args == format
        end
      }

      valid_args
    end
1020090
def execute
      subcmd_name = @match[1]
      return puts(help) unless subcmd_name

      subcmd = subcommand_list.match(subcmd_name)
      raise CommandNotFound.new(subcmd_name, self.class) unless subcmd

      subcmd.new(processor, arguments).execute
    end
363172
def validate(folder=None, cleanup=False):
    '''
    '''
    from expfactory.validator import ExperimentValidator
    cli = ExperimentValidator()
    return cli.validate(folder, cleanup=cleanup)
236056
function validate(cmd, args, info) {
  info = info || {};
  var conf = info.conf || {}
    , authrequired = typeof conf.requirepass === 'string'
    , db = info.db
    , result;

  // handle quit command special case
  if(cmd === COMMANDS.QUIT) {
    // reply with an object that mimics succesful validation
    info.command = {
      cmd: cmd, args: args, def: Constants.MAP.quit, arity: true};
    return info;
  // validate command is known
  }else{
    info.command = validators.command(cmd, args, info);
  }

  // check args length (arity)
  info.command.arity = validators.arity(cmd, args, info);

  // handle authentication requests
  if(cmd === COMMANDS.AUTH) {
    info.conn.authenticated =
      validators.auth(cmd, args, info);
  // handle unauthenticated requests when auth is enabled
  }else if(authrequired && !info.conn.authenticated) {
    throw AuthRequired;
  }

  // check operation on the correct type of value
  // this validation extracts keys, looks up the values
  // to determine the type of the existing value
  // the val array (or null) is assigned to the command
  // info object so that calling code may re-use it and
  // save looking up keys and values again where necessary
  info.command.value = validators.type(cmd, args, info);

  return info;
}
1356431
def command?(cmd)
      !!system(cmd, out: ::File::NULL, err: ::File::NULL)
    end
477616
def _out_batch_cmdidx(cmd_array):
        
        out_batch_cmdidx = None
        for cmdidx, tok in enumerate(cmd_array):
            mat = BatchCommand.out_batch_pat.match(tok)
            if mat:
                if out_batch_cmdidx:
                    raise IndexError(
                        'OUT_BATCH is used multiple times in command below:%s$ %s' %
                        (os.linesep, list2cmdline(cmd_array)))
                out_batch_cmdidx = cmdidx
        return out_batch_cmdidx
489156
function _validateCommand(name, command) {
    if (!_.isString(command.description)) {
        throw new Error(sprintf('Command "%s" must have a description string', name));
    } else if (!_.isFunction(command.invoke)) {
        throw new Error(sprintf('Command "%s" must have an invoke function', name));
    }
}
689878
def is_valid_command(command)
      valid_commands = ["open", "close", "rsp", "syslog"]
      if !valid_commands.include?(command)
        @logger.error 'Invalid RELP command'
        raise Relp::InvalidCommand.new('Invalid command')
      end
    end
879276
function validate(cmd, args, info) {
  AbstractCommand.prototype.validate.apply(this, arguments);
  var sub = info.command.sub
    , cmd = sub.cmd
    , args = sub.args
  if(('' + cmd) === Constants.SUBCOMMAND.pubsub.channels.name) {
    if(args.length > 1) {
      throw UnknownSubcommand;
    }
  }
}
1140413
def string_format
      (command_environment.map do |key, value|
        [key, value].join("=")
      end + [command]).join(" ")
    end