def get_type(search):
    """returns (type, path) for a given topic/command."""
    if search == "topics":
        return (TYPE_LISTTOPICS, None)
    cmdpath = find_command(search)
    if cmdpath is not None:
        return (TYPE_CMD, cmdpath)
    if "(" in search and ")" in search:
        try:
            pn = int(search[search.index("(") + 1:search.index(")")])
        except:
            print(_stash.text_color("Invalid Pagenumber", "red"))
            sys.exit(1)
        search = search[:search.index("(")]
    else:
        pn = 1
    if "." in search:
        # FIXME: fix '.' in search shoild search only matching extensions
        # Example: 'man test.md' searches for 'test.md' instead of 'test'
        print(_stash.text_color("Searching for pages with '.' in the name is bugged and has been disabled.", "red"))
        sys.exit(1)
        to_search = search
        found = []
        for pp in PAGEPATHS:
            found += os.listdir(pp)
    else:
        to_search = search
        found = []
        for p in PAGEPATHS:
            found += [(fn[:fn.index(".")] if "." in fn else fn) for fn in os.listdir(p)]
    if to_search in found:
        ppc = []
        for pp in PAGEPATHS:
            ppc += [(fn, pp) for fn in os.listdir(pp)]
        ffns = [(fn, pp) if fn.startswith(to_search + ".") else None for fn, pp in ppc]
        ffn = list(filter(None, ffns))
        if len(ffn) == 0:
            # isdir
            pname = "page_" + str(pn)
            for pp in PAGEPATHS:
                dirpath = os.path.join(pp, to_search)
                if not os.path.exists(dirpath):
                    continue
                for fn in os.listdir(dirpath):
                    if fn.startswith(pname):
                        fp = os.path.join(dirpath, fn)
                        if not os.path.exists(fp):
                            print(_stash.text_color("Page not found!", "red"))
                        return (TYPE_PAGE, fp)
            return (TYPE_NOTFOUND, None)
        path = os.path.join(ffn[0][1], ffn[0][0])
        return (TYPE_PAGE, path)
    else:
        return (TYPE_NOTFOUND, None)
returns (type, path) for a given topic/command.
bin/man.py