INNER CODE UNIT · Python

arg_action

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

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":
        return ":file:_files"
    labels = {
        "int": "n",
        "real": "x",

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…