Shell Completion

    Set up intelligent auto-completion for commands, options, and structure names.

    structkit --print-completion supports exactly four shells: bash, zsh, tcsh, and fish. Bash, Zsh, and Tcsh scripts are generated by shtab; Fish scripts are generated natively by StructKit.

    Quick Setup

    Terminalbash
    # Auto-detect current shell and print install steps
    structkit completion install
    
    # Or specify explicitly
    structkit completion install zsh
    structkit completion install bash
    structkit completion install tcsh
    structkit completion install fish

    Manual Installation

    Bash, Zsh, and Tcsh require shtab (pip install shtab). Fish does not — StructKit generates Fish completions itself.

    Zsh

    pip install shtab
    mkdir -p ~/.zfunc
    structkit --print-completion zsh > ~/.zfunc/_struct
    # Add to ~/.zshrc:
    fpath=(~/.zfunc $fpath)
    autoload -U compinit && compinit
    exec zsh

    Bash

    pip install shtab
    mkdir -p ~/.local/share/bash-completion/completions
    structkit --print-completion bash > ~/.local/share/bash-completion/completions/struct
    source ~/.bashrc

    Tcsh

    pip install shtab
    structkit --print-completion tcsh > ~/.structkit-completion.tcsh
    # Add to ~/.tcshrc:
    source ~/.structkit-completion.tcsh

    Fish

    No shtab needed — generated natively by StructKit.

    mkdir -p ~/.config/fish/completions
    structkit --print-completion fish > ~/.config/fish/completions/structkit.fish

    Usage Examples

    Tab completionbash
    # Command completion
    structkit <Tab>
    # Shows: generate, generate-schema, validate, info, list
    
    # Structure name completion
    structkit generate <Tab>
    # Shows: ansible-playbook, docker-files, project/nodejs, etc.
    
    # Partial completion
    structkit generate git<Tab>
    # Shows: git-hooks, github/workflows/codeql, github/templates, etc.
    
    # Option completion
    structkit generate --<Tab>
    # Shows: --log, --dry-run, --backup, --file-strategy, etc.