jdugan6240 / kak-bundle

Mirror to https://codeberg.org/jdugan6240/kak-bundle. Contributions are accepted here, but they are preferred upstream.
BSD Zero Clause License
30 stars 3 forks source link

.git suffix #7

Closed mralusw closed 3 years ago

mralusw commented 3 years ago

There's an extra wrinkle in the command/url-to-subdir resolution: git-cloning an URL ending in .git creates a folder with .git removed. plug.kak solves this by always removing the .git suffix.

We should probably do this too; and probably not just for bundle URL.git, but also for bundle 'command ... /*.git', because command could be git clone. If the user really needs a .git subdir in bundle/plugins, they can append # ./subdir.git to the command.

jdugan6240 commented 3 years ago

So, essentially what you're suggesting is basically to strip ".git" from the end of the repo/command whenever bundle is called and then store the result in bundle_plugins? If so, then that raises an issue with the primary motivation behind the creation of kak-bundle - speed.

To my knowledge, you can't do this with just kakscript (please feel free to correct me if I'm wrong), so you'd have to spawn a shell to perform this logic. However, not having to spawn a shell within the bundle command is the main reason kak-bundle is faster than plug.kak. Losing that advantage would be to give up the primary reason this plugin manager exists in the first place.

In short, although I agree that stripping the *.git suffix would help remove inconsistencies between the subdirs stored in bundle_path and the values listed in bundle_plugins, I don't think this is achievable without removing kak-bundle's only real advantage over plug.kak. As a result, unless there's a way to do this in pure kakscript that I don't know of, I'm unfortunately going to have to close this as a wontfix.

mralusw commented 3 years ago

Don't forget we're on the same page about zero shell calls — have you looked at kak-bundle-plug? It's written in pure kakscript, because I figured out how to loop, catch a specific error, and streq / strne in kakscript.

However, this is irrelevant here. The only code that maps plugin URL/cmd to subdirs is shell code (correct me if I'm wrong). So the stripping would only happen in shell code that is... already shell code, not kakscript.

As to the more general question of whether it is possible to do string processing in kakscript: yes, it is possible. See sel-editor. It's tricky, but it works.

Again, this is irrelevant here. You already don't have kakscript code that maps from URLs/cmds to subdirs.

jdugan6240 commented 3 years ago

You make some good points. I thought that you were referring to stripping the suffix before storing the plugin name in bundle_plugins. Fair enough; I'll reopen.

jdugan6240 commented 3 years ago

OK, I just pushed a change that hopefully fixes this. It was actually fairly simple and seems to work on my end, but feel free to reopen if the issue isn't solved.