zqqw / pakku

Pacman wrapper with AUR support
GNU General Public License v3.0
39 stars 3 forks source link

Default editor setting #19

Closed omentic closed 2 years ago

omentic commented 2 years ago

pakku currently asks for your editor every time you inspect a PKGBUILD. This gets tedious after a while, and I've never had a use case where I wanted to use anything other than my default editor. So I was going to do one of the following:

I may take a look at implementing this over the weekend. Would either of these be something you all would be interested in?

zqqw commented 2 years ago

Yes - although I would add I don't get that behavior here. Pakku always uses nano for me, I have these values set:

$ env |grep EDITOR
EDITOR=nano
$ cat .bashrc |grep EDITOR
export EDITOR=nano

I've never looked at how that part works as it hasn't caused me any trouble, but if it does for you then it's certainly worth investigating. It could also be something to do with the shell or desktop you are using. And at some points pakku forks off processes in a way that may not preserve the user environment, or deliberately alters it to change between root and normal user permissions. In the past I used a c program I had written a few years ago to log out what was really happening in there, see attached text file which is really a c file, brief instructions in comments at the start and the usage - it was helpful for me anyway (although there may be other ways to achieve the same thing) when I was altering some of those exec parts for a Nim update to check it gave the same results.

envlogtest.c.txt

omentic commented 2 years ago

Ah, after checking out the code and playing around with getEnv() some, it's because I typically run sudo pakku. Mystery solved...

zqqw commented 2 years ago

Yes, glad you got that sorted, pakku is intended to be run as the user and asks for the password when required - but it's easy to forget when switching between pakku and pacman, I know! The environment used by sudo is a bit unique, I spent a while trying to get sudo ls output in color once, not sure I ever got that working - it doesn't use the bashrc in either your homedir or in /root, although sudo su will use the /root one in the resulting root shell. If you ever want to do something pakku related and haven't found anything else yourself I just wrote out a pakku to-do list here: https://github.com/zqqw/pakku/wiki/Plans That is kind of my approximate route map at this point - no guarantees on when or even if it all happens though, and other things may come up too.