def _search()

in cstar/command.py [0:0]


def _search(name, listdir=os.listdir, stat=os.stat, check_is_file=_stat_is_reg):
    """Returns a the filename for a given command"""
    if "/" not in name:
        listing = _list(listdir, stat, check_is_file)
        if name in listing:
            return listing[name]
    if check_is_file(stat(name)):
        return name
    raise FileNotFoundError("Failed to find definition for command %s" % (name,))