jorgebucaran / fisher

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

Feature request: option to force overwrite existing files #770

Closed edouard-lopez closed 10 months ago

edouard-lopez commented 11 months ago

Hello @jorgebucaran, long time no see!

I'm working to add k8s support in Fish, when I try to install pure from my local directory, I'm met with a bunch of warning:

❯ fisher install ./                                                                                      
fisher install version 4.4.3                                                                             
fisher: Cannot install "/home/edouard/projects/contributions/pure": please remove or move conflicting files first:
        /home/edouard/.config/fish/functions/_pure_check_for_new_release.fish                            
        /home/edouard/.config/fish/functions/_pure_detect_container_by_cgroup_method.fish                                                                                                                          
        /home/edouard/.config/fish/functions/_pure_detect_container_by_pid_method.fish                   
        /home/edouard/.config/fish/functions/_pure_format_time.fish                                      
        /home/edouard/.config/fish/functions/_pure_get_prompt_symbol.fish         

and

❯ fisher install ./
fisher install version 4.4.3
fisher: Cannot install "/home/edouard/projects/contributions/pure": please remove or move conflicting files first:
        /home/edouard/.config/fish/functions/fish_greeting.fish
        /home/edouard/.config/fish/functions/fish_mode_prompt.fish
        /home/edouard/.config/fish/functions/fish_prompt.fish
        /home/edouard/.config/fish/functions/fish_title.fish

Actual

The current solution is to run:

  1. my uninstall script _pure_uninstall
  2. then remove rm $__fish_config_dir/functions/fish_*.fish
  3. finally install with fisher install ./

Expected

fisher install --force ./
jorgebucaran commented 11 months ago

Hey @edouard-lopez, that warning pops up when you're trying to install a plugin that might overwrite files from another one, which isn't what you want. I tried to reproduce your situation by creating a local plugin, installing it, and then trying to reinstall it a couple of different ways, but I couldn't get the same issue. So, while it might be a bug, it seems like something else might be going on in your case. Did you maybe do something out of the ordinary, like messing with Fisher's universal variable state?

Let me take a look at your repo. Where is it?

Why do you need to run Pure's uninstaller for anything related to k8s support in Fish? Are you trying to add k8s support to Pure or Fish?

edouard-lopez commented 11 months ago

When developing a new feature, I'm regularly reinstalling the plugin using my local directory to check for the results. Yep, I'm working on displaying k8s contextual information see https://github.com/pure-fish/pure/issues/322

jorgebucaran commented 11 months ago

Sure, I also do that with plugins I develop and it shouldn't cause any issues. Therefore, your problem must be originating from somewhere else. My hunch is that it could be related to you perhaps (inadvertently?) messing with Fisher's state variables. This issue might disappear if you uninstall everything, clean up your universal variables, and then reinstall.

Can you share the repository link? I'd like to take a closer look and try to reproduce your issue, as I was unable to do so based just on your description.

edouard-lopez commented 11 months ago

Repo is here https://github.com/pure-fish/pure/

edouard-lopez commented 10 months ago

I circumvented the issue by improving my docker workflow.

To build a Fish 3.6.1 with a working pure

❯ make build-pure-on dev-pure-on FISH_VERSION=3.6.1

To run test against Fish 3.6.1 and working files

❯ make -s dev-pure-on FISH_VERSION=3.6.1 CMD='fishtape tests/_pure_prompt_k8s.test.fish'