MrMineDe / pakt

Pacman Shell Wrapper, to order and manager your packages in easy text files
GNU General Public License v2.0
2 stars 1 forks source link

Support autocomplete if possible #9

Open MrMineDe opened 3 weeks ago

MrMineDe commented 3 weeks ago

Autocomplete in zsh (probably same as bash) is implemented in pacman. It is probably smart to just take the pacman autocomplete file and change it up a bit. This collides with #2 though, because it will be pretty hard to generate the thing dynamically for all the options set in the config (if we go with that approach). And if we try to generate it dynamically, we cannot take the pacman file as a base...

TLDR; if we want a FULL autocomplete (like pacman) for everything across different package managers, It's going to be pretty hard

MrMineDe commented 3 weeks ago

https://gitlab.archlinux.org/pacman/pacman/-/tree/master/scripts/completion?ref_type=heads

hiimsergey commented 2 weeks ago

Other package managers like apt and dnf use a verbose syntax, mostly/only using words and not flags. I can't imagine implementng that here but I think it would be pretty easy if we did a separate project. In apt, for example, the package lists starts from the fourth argument on:

sudo apt install neovim firefox htop ...

By reading the third argument, you instantly know what mode to set. And you just filter out flags and categories.

MrMineDe commented 2 weeks ago

You can also check the mode as we do now in pakt-sync. See: 553da73 Here you would define "install" and "remove" and the program automatically searches all arguments for these keywords. But this belongs more in #19 than here

For autocomplete I would opt to ship changed autocomplete scripts from the package managers, that we make compatible with our + functionality, --pakt-help and other potential flags.

I think the simplicity of the +cat syntax makes these changes pretty trivial.

Then at the beginning of the script (if that works) we could load the correct autocomplete file from "PACKAGE_MANAGER" if we have one. Otherwise we could provide a simple one, that only supports our Syntax

hiimsergey commented 2 weeks ago

Good idea but I don‘t see how pacman‘s autocomplete could work well with apt or dnf 💀. Also, I find the idea of searching for „install“ and „remove“ in all arguments very unreliable since packages can contain these words, e.g. archinstall.

MrMineDe commented 2 weeks ago
  1. you would search for the exact word install not words, that contain them
  2. I would have seperate autocomplete files for different package managers. I think most provide one by themselves, that we can softfork. My idea is, that we dynamically load the correct autocomplete file, so you would not have 1. autocomplete file for all, but rather one for each supported package manager