Skip to content

PotatoChurch Version

The PotatoChurch Version

You can find the binary in the bin folder.

I went a little overboard with having a look at this project. That's mainly because I wanted to understand it better and also play with the Cobra cli library. It manages to make flags fully POSIX complient and also generates nice help strings. But I had to hack it a bit to be able to dynamically add commands (depending on the contents of the .pgpass file).

Sadly, the way this is (without any background daemon service) I don't think it's possible to have the properties cached. However, I believe I managed to get rid of some of the pain points you had.

For one - this version now uses named RegExp groups and also has only one RegExp for the whole .pgpass entry pattern. To make things even nicer, I've used the Regroup library which just takes in the whole file and looks for all matches. You could do this with the standard regex library but I think this is nicer (though this very much depends on your view on external dependencies).

Another nice thing I managed to figure out is the Shell STDIN/OUT interactivity - using syscall.Exec() instead of exec.Command().

The error handling is sadly a standard way of doing things in go.

One thing to checkout - the _test.go files. One of my favourite features of go is how it natively handles tests.

Note: I've been developing this on Ubuntu 22.04 LTS and the binary is compiled for the same. If you're running something else, change the build command in the Makefile accordingly (you can run go tool dist list to get the list of available distributions and architectures).

Peace!! 🎉 🌮 🙏

Edited by Potato Man

Merge request reports