Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

carapace

Describes how to use carapace.

referencedescription
actioncreate and modify shell completion actions
choicehow carapace resolves which completer to use
convertconvert a user spec into a native Go completer
envdefine and customize environment variable completion
integrateintegrate carapace into a cobra application
lexerbuild a parser/lexer for a DSL
macrodefine and customize macros
manprovide inline documentation
mcpwork with the MCP server
scrapescrape command into a spec
setupinstall and configure carapace
specdefine and customize specs
updateupdate 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 git and add missing environment variable completions for the ones with GIT_ prefix

look at the output of bat --help and 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 summarize that takes two git refs as positional argument and invokes crush to summarize the difference between them