INNER CODE UNIT · Python

emit_block

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

def emit_block(label: str, specs: list[str], indent: str = "        ") -> list[str]:
    """Emit a single `_arguments -s ...` call indented for a case branch."""
    if not specs:
        return [f"{indent}_arguments -s"]
    lines = [f"{indent}_arguments -s \\"]
    for i, sp in enumerate(specs):
        suffix = " \\" if i < len(specs) - 1 else ""
        lines.append(f"{indent}    {sp}{suffix}")
    return lines


def main() -> None:
    s = spec_mod.load()
    by_name = {o.name: o for o in s.options}

    out: list[str] = [HEADER]
    out.append("_vsearch() {")
    out.append("    local cmd w")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…