why show the 'Using PGENV_ROOT /something' msg every time?
hunleyd opened this issue · 5 comments
Just curious why every single invocation of the tool shows the 'Using PGENV_ROOT /something' message? Shouldn't this be hidden behind a verbose or debug flag? It makes using pgenv in scripting a bit of a pain as you have to throw away line 1 all the time.
PGENV_ROOT
is something outside of the normal configuration, and is automatically detected if the variable is not set. So, if you are constantly see the message about a different (i.e., externally forced) root, it means you are calling the script with PGENV_ROOT
set. Can you confirm?
Now, this means that in turn the PG_DATA
is computed starting from the current root, and so I believe that warning the user about a possible different root that he could expect is important (what if you initdb
the wrong root?).
One possible solution could be to redirect the output to stderr, what do you think?
Yes, i am explicitly setting it. And I understand that it is displaying because it is not the default. I just don't need to be reminded at every invocation :)
I think your idea of using stderr would work nicely.
You'd still see it all the time. I don't think I'd show it except via some command to show values, or a verbose mode, if we ever added one.
True, I'd see it when I'm running it interactively. But I wouldn't need to deal with it when I'm scripting something and using the stdout to pull a value (like using pgenv version
to get the currently in use pg version. I used to be able to do ver=$(pgenv version)
but now I have to do ver=$(pgenv version|tail -n 1)
). I initially asked for hiding it behind a verbose mode and still think that would be best, but using stderr is a decent enough compromise for now.