wfxr / forgit

:zzz: A utility tool powered by fzf for using git interactively.
MIT License
4.32k stars 136 forks source link

forgit-git not found when trying to use forgit on fish when installed via the AUR #270

Closed sandr01d closed 1 year ago

sandr01d commented 1 year ago

Check list

Environment info

Problem / Steps to reproduce

I tried reproducing #267 and found a similar (but I think different) issue with forgit on fish when installed via the forgit-git package in the AUR. When trying to run any forgit command in fish, I get an error like this:

fish: Unknown command: /usr/share/fish/conf.d/bin/git-forgit
/usr/share/fish/vendor_conf.d/forgit.plugin.fish (line 34): 
    "$FORGIT" add $argv
    ^
in function 'forgit::add'
        called on line 1 of file -
in function 'ga'

The reason for this is, that the PKGBUILD installs the forgit fish wrapper in usr/share/fish/vendor_conf.d/ and also symlinks git-forgit there with:

# fish install
install -Dvm644 conf.d/forgit.plugin.fish -t "$pkgdir/usr/share/fish/vendor_conf.d/"
install -dv "$pkgdir/usr/share/fish/vendor_conf.d/bin/"
ln -sv /usr/bin/git-forgit "$pkgdir/usr/share/fish/vendor_conf.d/bin/"

But we expect forgit-git in usr/share/fish/conf.d/bin/ here: https://github.com/wfxr/forgit/blob/ffda73bac3a435a9bbc6f29f2fd98517fbe5d9db/conf.d/forgit.plugin.fish#L4

Is the different directory name (conf.d/vendor_conf.d) a difference between macOS and Linux? When modifying the PKGBUILD, so that everything gets installed in conf.d instead, forgit does not become automatically available in fish. I am completely new to fish and don't know what the solution should be here. Maybe @cjappl knows more about this?

cjappl commented 1 year ago

Hmm. Good question.

So I wasn't the original one who wrote moved the script to conf.d. I'm not at my computer right now, but if you look back through the history, another contributor did that.

I think if we find that person we can ask them, they have a much better handle on fish packages than myself (I use "plain" fish, and don't fully understand the plugin infra)

sandr01d commented 1 year ago

Hey @FollieHiyuki, since you're the one that moved forgit.plugin.fish to conf.d in #117 / #119, would you mind taking a look at this? The corresponding issue is #116 in case anybody is looking for it. Is having the script in conf.d a requirement for fish plugin managers or could it also be moved to vendor_conf.d? @cjappl you're on macOS, right? Would you mind testing whether your setup works when the directory is renamed to vendor_conf.d? I think the only things that have to be done is renaming the directory and modifying this line accordingly:

https://github.com/wfxr/forgit/blob/ffda73bac3a435a9bbc6f29f2fd98517fbe5d9db/conf.d/forgit.plugin.fish#L4

carlfriedrich commented 1 year ago

For fisher the plugin definitely has to be in conf.d, otherwise it won't be installed:

https://github.com/jorgebucaran/fisher#creating-a-plugin

fish however reads plugin files from both directories:

https://fishshell.com/docs/3.3/index.html#configuration-files

So I think, we should leave the file in conf.d within the repository, but check for both paths from within the code.