Search the given command owner for a matching command.
334635
private RegisteredCommand searchCommands(String cmdOwner, HttpMethod method, String uri,
                                             String query, Map<String, String> variableMap) {
        Map<HttpMethod, SortedSet<RegisteredCommand>> evalMap = getCmdEvalMap(cmdOwner);
        if (evalMap == null) {
            return null;
        }
        
        // Find the sorted command set for the given HTTP method.
        SortedSet<RegisteredCommand> cmdSet = evalMap.get(method);
        if (cmdSet == null) {
            return null;
        }
        
        // Split uri into a list of non-empty nodes.
        List<String> pathNodeList = new ArrayList<>();
        String[] pathNodes = uri.split("/");
        for (String pathNode : pathNodes) {
            if (pathNode.length() > 0) {
                pathNodeList.add(pathNode);
            }
        }
        
        // Attempt to match commands in this set in order.
        for (RegisteredCommand cmd : cmdSet) {
            if (cmd.matches(pathNodeList, query, variableMap)) {
                return cmd;
            }
        }
        return null;
    }
1118532
def detect_command(cmdlist):
    ''''''

    for platform, command, args in cmdlist:
        if platform is None or sys.platform == platform:
            path = shutil.which(command)
            if path:
                return ' '.join([path, args])

    return ''
207033
def get_command(name):
    ''''''
    command = global_commands_table.get(name.lower())
    if not command:
        raise CommandNotFound(name)
    return command
336459
def _get_command_by_name(self, blueprint, name):
        
        commands = self._get_commands_by_name(blueprint, name)

        if len(commands):
            return commands[0]
228753
def match(self, *command_tokens, **command_env):
		
		command = self.command()
		if len(command_tokens) >= len(command):
			return command_tokens[:len(command)] == command
		return False
793200
def help(ctx, command):
    """"""
    command = ' '.join(command)
    if not command:
        click.echo(cli.get_help(ctx))
        return

    cmd = cli.get_command(ctx, command)
    if cmd:
        click.echo(cmd.get_help(ctx))
    else:
        click.echo(cli.get_help(ctx))
1222249
public function locateCommand($command)
	{
		switch ($this->getOperatingSystem()) {
			case self::OS_OSX:
			case self::OS_LINUX:
				exec(sprintf('/usr/bin/which %s', $command), $result, $returnCode);
				if (isset($result[0])) {
					$result = $result[0];
				}
				break;
			case self::OS_WIN:
				exec(sprintf('where %s', $command), $result, $returnCode);
				if (isset($result[0])) {
					$result = $result[0];
				}
				break;
			default:
				return false;
		}

		if (empty($result)) {
			return false;
		}

		return $result;
	}
1115550
def _rudimentary_get_command(self, args):
        
        nouns = []
        command_names = self.commands_loader.command_table.keys()
        for arg in args:
            if arg and arg[0] != '-':
                nouns.append(arg)
            else:
                break

        def _find_args(args):
            search = ' '.join(args).lower()
            return next((x for x in command_names if x.startswith(search)), False)

        # since the command name may be immediately followed by a positional arg, strip those off
        while nouns and not _find_args(nouns):
            del nouns[-1]

        # ensure the command string is case-insensitive
        for i in range(len(nouns)):
            args[i] = args[i].lower()

        return ' '.join(nouns)
824427
@Then("^the command output contains '(.+?)'$")
    public void findShellOutput(String search) throws Exception {
        assertThat(commonspec.getCommandResult()).as("Contains " + search + ".").contains(search);
    }
611161
def match(self, command_context=None, **command_env):
		
		spec = self.specification()
		if command_context is None and spec is None:
			return True
		elif command_context is not None and spec is not None:
			return command_context == spec
		return False
1288758
def do_search(self, line):
        
        args = self._split_args(line, 0, -1)
        query = " ".join([_f for _f in args if _f])
        self._command_processor.search(query)
144017
def set_owner
      return unless owner || group
      chown = command? 'chown'

      return unless chown

      cmd = [chown, '-R', "#{owner}:#{group}", destination_path]
      logger.debug { "Running command: #{cmd.join ' '}" }
      system(*cmd)
    end
33897
def _get_commands_by_name(self, blueprint, name):
        
        return list(filter(lambda value: value.name == name, blueprint.get_commands()))
1297923
def owner(self):
        
        """
        if os.name == 'nt':
            if win32security is None:
                raise Exception("path.owner requires win32all to be installed")
            desc = win32security.GetFileSecurity(
                self, win32security.OWNER_SECURITY_INFORMATION)
            sid = desc.GetSecurityDescriptorOwner()
            account, domain, typecode = win32security.LookupAccountSid(None, sid)
            return domain + u'\\' + account
        else:
            if pwd is None:
                raise NotImplementedError("path.owner is not implemented on this platform.")
            st = self.stat()
            return pwd.getpwuid(st.st_uid).pw_name
1321042
def _filter_commands(ctx, commands=None):
    """"""
    lookup = getattr(ctx.command, 'commands', {})
    if not lookup and isinstance(ctx.command, click.MultiCommand):
        lookup = _get_lazyload_commands(ctx.command)

    if commands is None:
        return sorted(lookup.values(), key=lambda item: item.name)

    names = [name.strip() for name in commands.split(',')]
    return [lookup[name] for name in names if name in lookup]
1202129
def _get_ownership(self, data):
        
        rank = self.comm.rank

        B = [(rank, idx) for (idx, c) in enumerate(data) if c is not None]
        C = self.comm.allreduce(B)
        ownership = [None] * len(data)
        for c in C:
            ownership[c[1]] = c[0]
        return ownership
448747
def which(cmd, safe=False):
    """"""
    from autopaths.file_path import FilePath
    def is_executable(path):
        return os.path.exists(path) and os.access(path, os.X_OK) and not os.path.isdir(path)
    path, name = os.path.split(cmd)
    if path:
        if is_executable(cmd): return FilePath(cmd)
    else:
        for path in os.environ['PATH'].split(os.pathsep):
            candidate = os.path.join(path, cmd)
            if is_executable(candidate): return FilePath(candidate)
    if not safe: raise Exception('which failed to locate a proper command path "%s"' % cmd)