Context
pkgwrap now has 8 subcommands, 7 command aliases, 17 backends and several
flags. Tab completion would remove most of the remaining friction, and it's
the last unchecked item in the README roadmap that doesn't need a design
debate first.
Proposal
Add a hidden command that prints a completion script:
pkgwrap --completion bash
pkgwrap --completion zsh
pkgwrap --completion fish
Users wire it up themselves:
# bash
eval "$(pkgwrap --completion bash)"
# or
pkgwrap --completion bash | sudo tee /etc/bash_completion.d/pkgwrap
What should be completed
- Subcommands and their aliases (
install, in, add, remove, ...)
- Flags (
-y, --dry-run, --no-cache, --clear-cache, --version)
- Values for
--backend — generated from available_backends(), not
hardcoded, so it doesn't go stale when a backend is added
Completing package names is explicitly out of scope for a first pass:
it would mean querying the package manager on every tab press, which is
slow and backend-specific. That belongs in its own issue if wanted later.
Constraints
- No new runtime dependencies — pkgwrap has zero and that's a feature.
Generate the script as a plain string; don't pull in argcomplete.
- Must work on Python 3.9
Acceptance criteria
Pointers
src/pkgwrap/cli.py — build_parser() and COMMAND_ALIASES
src/pkgwrap/backends/__init__.py — available_backends()
Context
pkgwrap now has 8 subcommands, 7 command aliases, 17 backends and several
flags. Tab completion would remove most of the remaining friction, and it's
the last unchecked item in the README roadmap that doesn't need a design
debate first.
Proposal
Add a hidden command that prints a completion script:
Users wire it up themselves:
What should be completed
install,in,add,remove, ...)-y,--dry-run,--no-cache,--clear-cache,--version)--backend— generated fromavailable_backends(), nothardcoded, so it doesn't go stale when a backend is added
Completing package names is explicitly out of scope for a first pass:
it would mean querying the package manager on every tab press, which is
slow and backend-specific. That belongs in its own issue if wanted later.
Constraints
Generate the script as a plain string; don't pull in
argcomplete.Acceptance criteria
pkgwrap --completion <shell>prints a working script for bash, zsh, fishPointers
src/pkgwrap/cli.py—build_parser()andCOMMAND_ALIASESsrc/pkgwrap/backends/__init__.py—available_backends()