jorgebucaran / fisher

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

fisher update not install plugin but remove fish_plugins file #790

Open taikulawo opened 1 month ago

taikulawo commented 1 month ago

I sync fish config across machine by git. But on another machine I run fisher update, fisher just delete fish_plugins image

jorgebucaran commented 1 month ago

Hmm, I really can't help without more info. Maybe share your entire configuration and sync strategy, maybe in a Docker image or a repository.

taikulawo commented 1 month ago

extract to fish/ then run fisher update fish.tar.gz

jorgebucaran commented 1 month ago

Could you share the contents here instead?

taikulawo commented 1 month ago

sure. fish_plugins file

jorgebucaran/fisher
patrickf1/fzf.fish

and install fisher

jorgebucaran commented 1 month ago

Is that what's in your gzipped tar file? What I need is your complete configuration and sync setup. Without it, reproducing your state won't be possible anytime soon.

taikulawo commented 1 month ago

https://github.com/taikulawo/home I clone (means sync)it on my homedir

jorgebucaran commented 1 month ago

The only file I'd put in my dot files would be fish_plugins, similar to how you wouldn't sync node_modules.

taikulawo commented 1 month ago

I dont understand, I'm wrong?

jorgebucaran commented 1 month ago

I saw you're committing all Fish files in your repo, including plugins likely installed with Fisher. In that case, what would be the purpose of fish_plugins? This file serves as a manifest of your plugins and should be enough for syncing across different machines. You'd simply use fisher install to install the plugins instead of relying on git.

taikulawo commented 1 month ago

Does fisher install not extra argument can install all plugin in manifest?

$ fisher install
fisher: Not enough arguments for command: "install"

sometime my network is offline, so I need to sync plugin file at first. but why fisher delete fish_plugins when I run fisher update?

jorgebucaran commented 1 month ago

Thanks for the clarification. You're right, it's fisher update (not install), as indicated in the docs. 👍

jorgebucaran commented 1 month ago

Yes, Fisher will delete fish_plugins, but only if it's empty. For example, if you remove all plugins from fish_plugins and then run fisher update, Fisher will uninstall all plugins and subsequently delete the file.

https://github.com/jorgebucaran/fisher/blob/2efd33ccd0777ece3f58895a093f32932bd377b6/functions/fisher.fish#L210-L213

taikulawo commented 1 month ago

but my file_plugins is not empty

jorgebucaran commented 1 month ago

My approach to test this:

This process should make sure that B is updated to match A, which is how Fisher is supposed to work.

taikulawo commented 1 month ago

oh, I found reason when I init fisher, fisher add following variables to fish_variables file. But my sync don't include it. On another manchine which don't have this variable, fisher will remove fish_plugins file

SETUVAR __fish_initialized:3400
SETUVAR _fisher_jorgebucaran_2F_fisher_files:\x7e/\x2econfig/fish/functions/fisher\x2efish\x1e\x7e/\x2econfig/fish/completions/fisher\x2efish
SETUVAR _fisher_plugins:jorgebucaran/fisher
taikulawo commented 1 month ago

Is those variable necessary? I think fish_plugins is enough

jorgebucaran commented 1 month ago

The approach I outlined above should do for a basic setup. For example, if you uninstall all your plugins, start from scratch, create a fish_plugins file, add several plugins to it, and then run fisher update, Fisher should install those plugins. But if this isn't enough for you, how about committing your fish_variables in addition to your fish_plugins.

taikulawo commented 1 month ago

fish_variables is platform special. I sync all my conf across different platform, linux/mac, so fish_variables isn't suitable for my case if I sync it, which make linux variable sync to windows, broken

taikulawo commented 1 month ago

from my test, If target machine don't have fisher special variable in fish_variables, fisher update will broken, delete fish_plugin file

jorgebucaran commented 1 month ago

Fisher cleans and variables before saving or reading from fish_variables to prevent some basic issues, e.g.:

https://github.com/jorgebucaran/fisher/blob/2efd33ccd0777ece3f58895a093f32932bd377b6/functions/fisher.fish#L141

...but I don't know about Windows.

jorgebucaran commented 1 month ago

What I did: I made sure there were no Fisher variables in fish_variables, uninstalled everything Fisher-related, created an empty fish_plugins file, added some plugins, thus replicating a machine without Fisher but with my fish_plugins file. Then, fisher update, and it behaved as expected; the plugins were installed.

taikulawo commented 1 month ago

you should exit fish, and reopen a new fresh fish instance, make sure there not fisher variable. then fisher update

jorgebucaran commented 1 month ago

I did that and succeeded. Did that not work for you?

taikulawo commented 1 month ago
rm -rf ~/.config/fish
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
rm ~/.config/fish/fish_variables
# let fish exit now

# open a new fish shell
# make sure no value output
echo $_fisher_plugins
# run fisher update, fish_plugins file should be deleted
fisher update
jorgebucaran commented 1 week ago

To clarify, did this work out for you?

taikulawo commented 1 week ago
rm -rf ~/.config/fish
curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
rm ~/.config/fish/fish_variables
# let fish exit now

# open a new fish shell
# make sure no value output
echo $_fisher_plugins
# run fisher update, fish_plugins file should be deleted
fisher update

no, it's bug reproduce step.