Skip to content

feat(completions): add bash and zsh completions#20

Open
CheapFuck wants to merge 1 commit into
codam-coding-college:mainfrom
CheapFuck:feat/shell-completions
Open

feat(completions): add bash and zsh completions#20
CheapFuck wants to merge 1 commit into
codam-coding-college:mainfrom
CheapFuck:feat/shell-completions

Conversation

@CheapFuck

Copy link
Copy Markdown

Closes #5.

Adds shell completion scripts for bash and zsh.

What

  • New user/local/share/towel/completions/towel.bash and .../_towel.
    They are installed to ~/.local/share/towel/completions/ automatically by the existing towel_install_from_dir copy step (the whole user/local/share/towel tree is copied during ./install).
  • Completions cover:
    • subcommands: create enter exec export install remove update
    • top-level options: -h/--help, -v/--version
    • per-subcommand flags (e.g. update --check/--apply/--no-auto-check/--auto-check/-y/--yes/--quiet, install -y/--yes, remove -y/--yes/-h/--help)
    • exec completes the command to run inside the container
  • Package-name positions (install/export) are intentionally left to default completion to avoid slow container/dnf queries.
  • README gains a Shell completions section explaining how to enable them for bash (source the file) and zsh (add the dir to fpath before compinit).

Notes

  • The completion files live under completions/, not bin/, so they are outside the CI shellcheck/shfmt glob (bin/towel and bin/towel-*). This is deliberate: the zsh #compdef file is not POSIX/bash and would not pass plain shellcheck. The existing CI set still passes (verified locally with shellcheck -x and shfmt -d).
  • The bash completion was exercised locally (top-level commands, partial matches, per-subcommand flags, and empty package positions all behave as expected).
  • I left the installer enabling of completions as a manual, documented step rather than auto-editing .bashrc/.zshrc (especially compinit), to avoid intruding on user shell config. Happy to wire it into ./install if you prefer.

Add shell completion scripts for bash and zsh under
user/local/share/towel/completions/ (installed to
~/.local/share/towel/completions/ by the existing copy step).

Completions cover the subcommands (create/enter/exec/export/install/
remove/update), the top-level -h/--help and -v/--version options, and
the per-subcommand flags. Package-name positions are left to default
completion to avoid slow container/dnf queries. Document how to enable
them for bash and zsh in the README.

Closes codam-coding-college#5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shell completions

1 participant