xxh / xxh-shell-fish

Use the fish shell wherever you go through the SSH without installation on the host.
BSD 2-Clause "Simplified" License
18 stars 12 forks source link

What would be the correct way to add fish completions? #13

Open tlaerm opened 3 years ago

tlaerm commented 3 years ago

I'm still getting used to the xxh structure and want to add docker completions to my fish. If I just add them to the local .xxh they will not be updated when the upstream changes.

So would I make a plugin that curls https://raw.githubusercontent.com/docker/cli/master/contrib/completion/fish/docker.fish and the one for docker-compose?

tlaerm commented 3 years ago

Context: These completions get added to local shells from the docker packages and are stored in /usr/share/fish/vendor_completions.d (on an Ubuntu system).

anki-code commented 3 years ago

Hi @rdd2!

Something tells me that you can just source this files. What if you run source /usr/share/fish/vendor_completions.d/docker.fish - is it working?

If yes this means that you can:

  1. Fork xxh-plugin-fish-example or xxh-plugin-fish-ohmyfish
  2. Rename it to xxh-plugin-fish-docker
  3. Change the build.sh script to curl the files and place it to the build dir
  4. Finally add getting the plugin directory and the "sourcing" the files to the pluginrc file i.e. like in xxh-plugin-fish-ohmyfish

If it's not working for you and the completion files should be in appropriate directory the good start is to understand how to change the path to this directory.

PS: How xxh works: Detailed workflow with code

frederickjh commented 3 years ago

@rdd2 Completions for the Fish shell locally should be placed in ~/.config/fish/completions. If you are using the xxh-plugin-fish-userconfig plugin then locally they would go in ~/.xxh/.xxh/config/xxh-plugin-fish-userconfig/fish/completions so that they are transferred to the remote xxh host.

From the help for the xxh-plugin-fish-userconfig plugin:

Fish Shell Remote Host Configuration

Place the configuration files you want transfered to the remote host in ~/.xxh/.xxh/config/xxh-plugin-fish-userconfig/fish on your local computer. The files in this folder are the same as you would place in the ~/.config/fish/ directory for your local Fish shell installation.

You can create directories for functions, completions, and program configuration conf.d. These directories and their contents will be transfered to the remote host. They will be copied into the xxh Fish shell's configuration directory.