Get the path of a command in the virtual if it exists.

        Args:
            cmd (str): The command to look for.

        Returns:
            str: The full path to the command.

        Raises:
            ValueError: If the command is not present.
15813
def cmd_path(self, cmd):
        
        for binscript in self.bin.files:

            if binscript.path.endswith('/{0}'.format(cmd)):

                return binscript.path

        raise ValueError('The command {0} was not found.'.format(cmd))
410859
def which(command)
      ENV['PATH'].split(File::PATH_SEPARATOR).map {|e| File.join(e, command) }.find {|e| File.exists?(e) }
    end
618883
def main(self, argv=None, exit=True):
        
        return CommandRecipe(self).main(argv, exit)
1219354
def getCommandLine(self):
        
        commandLine = self.precursor + self.sep if self.precursor else ''
        commandLine += self.cd + ' ' + self.path + self.sep if self.path else ''
        commandLine += PosixCommand.getCommandLine(self)
        return commandLine
622407
def getproject_cmd(argv):
    
    # Parse command line arguments
    parser = argparse.ArgumentParser(
        description="Print an environment's project directory.",
    )
    parser.add_argument(
        'envname',
        nargs='?',
        default=os.environ.get('VIRTUAL_ENV'),
        help=(
            'The name of the environment to return the project directory '
            'for.  If omitted, will use the currently active environment.'
        ),
    )
    args = parser.parse_args(argv)
    # Now, do the actual work
    if not args.envname:
        sys.exit('ERROR: no virtualenv active')
    if not (workon_home / args.envname).exists():
        sys.exit("ERROR: Environment '{0}' does not exist."
                 .format(args.envname))
    project_dir = get_project_dir(args.envname)
    if project_dir is None:
        sys.exit("ERROR: no project directory set for Environment '{0}'"
                 .format(args.envname))
    print(project_dir)
1295417
def get(name, *args, **kwargs):
    
    cmd = COMMAND_MAPPER.get(name)
    return cmd(*args, **kwargs)
1275873
def find_command(cmd, path=None, pathext=None):
    
    if path is None:
        path = os.environ.get('PATH', '').split(os.pathsep)
    if isinstance(path, string_types):
        path = [path]

    # check if there are path extensions for Windows executables
    if pathext is None:
        pathext = os.environ.get('PATHEXT', '.COM;.EXE;.BAT;.CMD')
        pathext = pathext.split(os.pathsep)

    # don't use extensions if the command ends with one of them
    for ext in pathext:
        if cmd.endswith(ext):
            pathext = ['']
            break

    # check if we find the command on PATH
    for p in path:
        f = os.path.join(p, cmd)
        if os.path.isfile(f):
            return f
        for ext in pathext:
            fext = f + ext
            if os.path.isfile(fext):
                return fext
    return None
715770
def command_line(cmd):
    
    try:
        s = subprocess.Popen(cmd, stdout=subprocess.PIPE)
        s = s.stdout.read()

        return s.strip()

    except subprocess.CalledProcessError:
        return 0
745654
def onecmd(self, line):
        
        if not self.commands_defining:
            return cmd.Cmd.onecmd(self, line)
        else:
            return self.handle_command_def(line)
677693
def get_cmd_line(self):
    

    cmd = ""
    cmd_list = self.get_cmd_tuple_list()
    for argument in cmd_list:
      cmd += ' '.join(argument) + " "

    return cmd
620807
def get_command_class(self, cmd):
        
        try:
            cmdpath = self.registry[cmd]
        except KeyError:
            raise CommandError("No such command %r" % cmd)
        if isinstance(cmdpath, basestring):
            Command = import_class(cmdpath)
        else:
            Command = cmdpath
        return Command
1019976
def which(cls, cmd):
        
        abs_path_cmd = None
        if sys.version_info >= (3, 3):
            abs_path_cmd = shutil.which(cmd)
        else:
            abs_path_cmd = find_executable(cmd)
        return abs_path_cmd
350451
def get_absolute_tool_path(command):
    
    assert isinstance(command, basestring)
    if os.path.dirname(command):
        return os.path.dirname(command)
    else:
        programs = path.programs_path()
        m = path.glob(programs, [command, command + '.exe' ])
        if not len(m):
            if __debug_configuration:
                print "Could not find:", command, "in", programs
            return None
        return os.path.dirname(m[0])
233323
function (cmd) {
			return self.alreadyProcessedTraces[cmd.modelElement.path()] && self.alreadyProcessedTraces[cmd.modelElement.path()][cmd.toString()];
		}
27
def get_manager_cmd(self):
        """"""
        cmd = os.path.abspath(os.path.join(os.path.dirname(__file__), "server", "notebook_daemon.py"))
        assert os.path.exists(cmd)
        return cmd
1048898
def getpath(cmd, name=None, url=None, cfg="~/.jcvirc", warn="exit"):
    
    p = which(cmd)  # if in PATH, just returns it
    if p:
        return p

    PATH = "Path"
    config = RawConfigParser()
    cfg = op.expanduser(cfg)
    changed = False
    if op.exists(cfg):
        config.read(cfg)

    assert name is not None, "Need a program name"

    try:
        fullpath = config.get(PATH, name)
    except NoSectionError:
        config.add_section(PATH)
        changed = True
    except:
        pass

    try:
        fullpath = config.get(PATH, name)
    except NoOptionError:
        msg = "=== Configure path for {0} ===\n".format(name, cfg)
        if url:
            msg += "URL: {0}\n".format(url)
        msg += "[Directory that contains `{0}`]: ".format(cmd)
        fullpath = input(msg).strip()
        config.set(PATH, name, fullpath)
        changed = True

    path = op.join(op.expanduser(fullpath), cmd)
    if warn == "exit":
        try:
            assert is_exe(path), \
                "***ERROR: Cannot execute binary `{0}`. ".format(path)
        except AssertionError as e:
            sys.exit("{0!s}Please verify and rerun.".format(e))

    if changed:
        configfile = open(cfg, "w")
        config.write(configfile)
        logging.debug("Configuration written to `{0}`.".format(cfg))

    return path
1296610
def get_command(self, ctx: click.Context, name: str) -> click.Command:
        
        info = ctx.ensure_object(ScriptInfo)
        command = None
        try:
            command = info.load_app().cli.get_command(ctx, name)
        except NoAppException:
            pass
        if command is None:
            command = super().get_command(ctx, name)
        return command