Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export install command, too #649

Open
blaggacao opened this issue Dec 23, 2022 · 1 comment
Open

Export install command, too #649

blaggacao opened this issue Dec 23, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@blaggacao
Copy link

blaggacao commented Dec 23, 2022

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.

@rsteube
Copy link
Member

rsteube commented Dec 24, 2022

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)"]

@rsteube rsteube added the enhancement New feature or request label Dec 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants