jorgebucaran / fisher

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

Initialize _fisher_plugins using fish_plugins file (#741) #746

Open charego opened 1 year ago

charego commented 1 year ago

This change is for users who commit fish_plugins and plugin sources but omit fish_variables.

On a system where Fisher's universal variables are unset, most Fisher commands do not work out-of-the-box:

As of this commit all Fisher commands work except for fisher remove. Fisher still has no way of knowing which files to remove absent the universal variable that tracks the files associated to a plugin. It may make sense to reject calls like fisher remove repo/plugin if the _fisher_repo_2F_plugin_files universal variable is missing. Fisher could suggest the user run fisher update and try again.

Note: I haven't really investigated how this works with local plugins since I don't use those.

Attempt to fix https://github.com/jorgebucaran/fisher/issues/741.

charego commented 1 year ago

Bump for further consideration, @jorgebucaran. Thanks.

jorgebucaran commented 1 year ago

I have been addressing and investigating issues all weekend, so I am taking a break for now. However, I wanted to let you know that I will certainly look into this matter soon and will incorporate this change (or a similar one, as I'm not certain this will be merged as is) before Fisher 5. This should occur in the not-too-distant future. 🙏

ZuBB commented 10 months ago

Is the issue described here possibly related to one I have?

vv@my-precious ~/.config/fish/conf.d $ fisher install oh-my-fish/plugin-bang-bang
fisher install version 4.4.3
Fetching https://api.github.com/repos/oh-my-fish/plugin-bang-bang/tarball/HEAD
fisher: Invalid plugin name or host unavailable: "oh-my-fish/plugin-bang-bang"
vv@my-precious ~/.config/fish/conf.d $ ll
jorgebucaran commented 10 months ago

I doubt it. It might be related to the curl or tar version or your OS. What's your OS, distro, and the curl and tar version you're using?

https://github.com/jorgebucaran/fisher/blob/59228d6215cb4c36aff77008751736f540dc42d8/functions/fisher.fish#L101-L106

ZuBB commented 10 months ago

I doubt it. It might be related to the curl or tar version or your OS. What's your OS, distro, and the curl and tar version you're using?

its latest macos with m1 chip

vv@my-precious ~/work/own/careerpartner/src $ curl -V
curl 7.88.1 (x86_64-apple-darwin22.0) libcurl/7.88.1 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.11 nghttp2/1.51.0
Release-Date: 2023-02-20
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS GSS-API HSTS HTTP2 HTTPS-proxy IPv6 Kerberos Largefile libz MultiSSL NTLM NTLM_WB SPNEGO SSL threadsafe UnixSockets
vv@my-precious ~/work/own/careerpartner/src $ tar --version
bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 
vv@my-precious ~/work/own/careerpartner/src $ 
ZuBB commented 10 months ago

okay, I figured it out

https://github.com/jorgebucaran/fisher/pull/771

jorgebucaran commented 10 months ago

@charego Sorry, but can you break down the main goal and reason for this PR again? Why's it a must-have?

charego commented 10 months ago

Essentially, how to use Fisher with dotfiles? Is there a best practice as you see it? The instructions are geared toward interactive use. I would like to bootstrap Fisher from dotfiles on a new machine without interactive use.

o-az commented 3 months ago

Essentially, how to use Fisher with dotfiles? Is there a best practice as you see it? The instructions are geared toward interactive use. I would like to bootstrap Fisher from dotfiles on a new machine without interactive use.

Same here. I would like to use Fisher declaratively through Nix Home Manager. Haven't had any luck so far.

jorgebucaran commented 3 months ago

Honestly, the reason I haven't been able to work on this is because I don't understand the aim at a fundamental level. Do you just want Fisher to fail silently if universal variables are not set?

itsfarseen commented 3 months ago

@jorgebucaran, from what I understand, the idea is to not use fish_variables to store fisher state as some of us don't commit fish_variables to our dotfiles repo.

So our options are:


The reason we don't commit fish_variable is that it'll contain state that's only relevant to one machine.

For example, mine contains a bunch of variables set by Z that points to folders in my home dir, and the home dir will be different in different machines because of different usernames.

itsfarseen commented 3 months ago

@jorgebucaran One more thing to consider before merging this, maybe we should commit fish_variables to the dotfiles repo.

Plugins should not store non-portable data in fish_variables.

For reference: https://github.com/jorgebucaran/fisher/issues/611 https://github.com/jethrokuan/z/issues/104

jorgebucaran commented 3 months ago

@itsfarseen from what I understand, the idea is to not use fish_variables to store fisher state as some of us don't commit fish_variables to our dotfiles repo.

That sounds a lot like https://github.com/jorgebucaran/fisher/issues/611. Fisher preserves the '~' in paths when saving plugins to the universal state, making it safer to commit fish_variables. While it might not be perfect, it does prevent committing data that obviously varies across machines, such as different usernames or home directories. What else are we missing?

itsfarseen commented 3 months ago

@jorgebucaran

Fisher preserves the '~' in paths when saving plugins to the universal state

Yes, but Z doesn't. And possibly other plugins too.

OP's solution to this is to not commit fish_variables to the dotfiles repo.

My opinion is that, ideally we should ask Z and other problematic plugins to implement proper handling of fish_variables, instead of trying to make fisher work with missing fish_variables.