jorgebucaran / fisher

A plugin manager for Fish
https://git.io/fisher
MIT License
7.71k stars 263 forks source link

updating packages from fish_plugins #673

Closed bdarcus closed 3 years ago

bdarcus commented 3 years ago

I'm wondering about this section of the README on updating via the fish_plugins file.

https://github.com/jorgebucaran/fisher#using-your-fish_plugins-file

I was expecting that if I moved/symlinked that version-controlled file to my fish dir, that fisher would install packages missing from that list upon running fisher update.

So two questions:

  1. Am I correct that's not currently possible?
  2. Is there a reason it wouldn't be in the future?

Thanks for this project, BTW; it's really elegant in its simplicity and flexibility.

jorgebucaran commented 3 years ago

Fisher will install plugins missing in your system listed in fish_plugins upon running fisher update. That's exactly what Fisher does. It will also remove installed plugins that are not on the list.

Fisher knows which plugins it should install, update, or remove by diffing the contents of $__fish_config_dir/fish_plugins against its global state, e.g.:

$ printf "%s\n" $_fisher_plugins
jorgebucaran/fisher
jorgebucaran/nvm.fish
jorgebucaran/hydro.fish
jorgebucaran/autopair.fish
jorgebucaran/spark.fish
jorgebucaran/replay.fish

If I modify fish_plugins as follows, and run fisher update:

jorgebucaran/fisher
jorgebucaran/nvm.fish
+ ilancosman/tide
- jorgebucaran/hydro.fish
- jorgebucaran/autopair.fish
- jorgebucaran/spark.fish
- jorgebucaran/replay.fish

Fisher will update Fisher and nvm.fish (because they are still on the list), remove everything else, and install Tide.

bdarcus commented 3 years ago

Got it.

I was missing that was a diff.

Sorry, and thanks for taking the time to explain.

Edit: except I can't run fisher install without an additional argument.

jorgebucaran commented 3 years ago

Correction: fisher update, not install.

bdarcus commented 3 years ago

Correction: fisher update, not install.

That makes sense :-)

This bit in that section is what confused me:

"You can also edit this file and run fisher update to commit changes. Here's an example:"

As I said above, in retrospect I should have understood the example below was referring to a diff of the file, but this might be more clear?

"You can also edit this file and run fisher update to commit changes. Here's an example diff that represents such an edit:"

bdarcus commented 3 years ago

Hmm .. I so I added the autopair plugin to the end of the list so that I now have 11, but running fisher update did not include it.

Screenshot from 2021-04-20 07-46-01

jorgebucaran commented 3 years ago

It's hard to say without a full log and a dump of your set environment. Check $__fish_config_dir/fish_plugins.

jorgebucaran commented 3 years ago

As I said above, in retrospect I should have understood the example below was referring to a diff of the file, but this might be more clear?

"You can also edit this file and run fisher update to commit changes. Here's an example diff that represents such an edit:"

You are welcome to open a PR. 😄

bdarcus commented 3 years ago

You are welcome to open a PR.

Just wanted conformation before doing that.

PR is at #674.

It's hard to say without a full log and a dump of your set environment. Check $__fish_config_dir/fish_plugins.

So I had setup that file as a symlink.

If I instead copy over the actual file, it works.

Should I not use a symlink, or is there some nuance I'm missing on how best to do that?

jorgebucaran commented 3 years ago

Maybe Fisher doesn't know how to write to fish_plugins if it's a symlink.

Here's the relevant code:

https://github.com/jorgebucaran/fisher/blob/b9b1eda07a9325e7641f3f79f9c7a08d8de3b357/functions/fisher.fish#L184-L186

bdarcus commented 3 years ago

Maybe Fisher doesn't know how to write to fish_plugins if it's a symlink.

I'm new to fish also and so learning how it deals with symlinks and such.

But I just did some testing, and it seems like it should work.

I'll do some more experimenting. Worst case I'll just copy over the file, rather than symlink.