glow icon indicating copy to clipboard operation
glow copied to clipboard

Add an environment variable to control the config path.

Open ptrck0 opened this issue 1 year ago • 1 comments

Not everyone wants to use Mac OS's default config path "~/Library/Preferences/" as returned by go-paths.

This patch includes the environment variable GLOW_CONFIG_HOME to set, so Mac OS users don't have to run glow --config ~/.config/glow/glow.yml or something like that. If you set the config variable, it is used, if not, the original flow is used.

Oh, and a small spelling error fix.

ptrck0 avatar Mar 16 '24 16:03 ptrck0

This will close this issue.

ptrck0 avatar Mar 16 '24 17:03 ptrck0

I would love to see this approved. I consolidate my dotfiles on macos all to ~/.config.

Additionally it might be worth respecting the XDG_CONFIG_HOME environment variable by default which would help glow use the user's preferred config directory more accurately without requiring GLOW_CONFIG_HOME to be set.

jesseb34r avatar Jun 25 '24 17:06 jesseb34r

I didn't check at glow code for now, but I expect it to use

https://pkg.go.dev/os#UserConfigDir

https://cs.opensource.google/go/go/+/refs/tags/go1.22.4:src/os/file.go;l=509

So you would like to overload it when the XDG_CONFIG_HOME env variable is present?

ccoVeille avatar Jun 25 '24 19:06 ccoVeille