carapace
carapace copied to clipboard
Export `install` command, too
Since carapace has context awareness for a lot of shells, it is a good place to improve dx for users to implement install
which would typically append a shell-specific string to a shell-specific rc-file.
For registering the completion? Not too sure about this, so far been wary of messing with peoples init files. Should be possible but things to consider here:
-
Directly sourcing the completion is considered bad practice as it slows down shell startup time considerably. Been working on lazycomplete to circumvent this issue.
-
Location of init files might vary (e.g. my
.zshrc
is now in~/.config/zsh
). -
Could slightly interfere with existing plugin managers or users way the config is written.
-
Checking if config already exists could be a challenge. E.g. zsh needs additional config like
compinit
for which a call might already exist in a separate sourced file. -
Nushell is a bit of a special case as well
Not against it, but i haven't figured out which way i want to go with this yet.
The direction i've been going for so far is a supporting a user spec. But that only make sense when carapace-bin is used.
For this a yaml file is simply placed in a specific folder, which works cross-shell and is loaded lazily.
It also enables embedding the completion in other commands like sudo example <TAB>
or gum spin example <TAB>
.
name: example
description: example completion
completion:
positionalany: ["$_bridge.Carapace(example)"]