INNER CODE UNIT · Python

file_glob

torognes/vsearch · completion/scripts/gen_zsh.py:41

def file_glob(extensions: list[str]) -> str:
    return "*.(" + "|".join(extensions) + ")"


def arg_action(s: spec_mod.Spec, opt: spec_mod.Option) -> str:
    """Return the `:label:action` suffix for a value-taking option, or "" for flags."""
    a = opt.arg
    if a.type == "flag":
        return ""
    if a.type == "enum":
        values = " ".join(s.enum_values(a.values))
        return f":value:({values})"
    if a.type == "file":
        if a.ftype is None:
            return ":file:_files"
        glob = file_glob(s.extensions(a.ftype))
        return f":file:_files -g '{glob}'"
    if a.type == "outfile":

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…