carapace
Describes how to use carapace.
| reference | description |
|---|---|
| action | create and modify shell completion actions |
| choice | how carapace resolves which completer to use |
| convert | convert a user spec into a native Go completer |
| env | define and customize environment variable completion |
| integrate | integrate carapace into a cobra application |
| lexer | build a parser/lexer for a DSL |
| macro | define and customize macros |
| man | provide inline documentation |
| mcp | work with the MCP server |
| scrape | scrape command into a spec |
| setup | install and configure carapace |
| spec | define and customize specs |
| update | update an existing completer |
Examples
Some asciicasts show an older version of the skills before these were combined into one.
Action
create and show me an action that completes users from /etc/passwd .
style them in red (root), yellow (system), default (regular).
examples: dbus (System Message Bus) dnsmasq (dnsmasq daemon)
for the repo completion query the api for repos where the current user has permissions to close pull requests.
the repo flag should just accept OWNER/REPO.
create a custom action in pkg/actions.
also, cache it for a day as these shouldn't change often
Env
create custom variable completion for https proxy with default ports
i've got one for development at localhost and a production one at proxy.example
style them accordingly
look at the manpage of
gitand add missing environment variable completions for the ones withGIT_prefix
look at the output of
bat --helpand create environment variable completion as user specs
Integrate
integrate carapace
create a standalone completer for the shell command
tail
i'm building my own git command. create completions for it.
- positional arguments are git refs
- default behaviour is to show a prettier git log for them (oneline, graph, make it fancy)
- add ref completion with a carapace macro (loosely coupled)
- dynamically embed git plugin commands at root level and bridge completions (executables with
git-prefix)- add dash completion since refs could clash with subcommands
minigit HEAD~1 master # show log for refs minigit clang-format # execute git-clang-format
Scrape
scrape https://github.com/balajz/pgxcli
Spec
create a runnable spec named
summarizethat takes two git refs as positional argument and invokescrushto summarize the difference between them