-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a switch command to pgenv #53
Conversation
This is interesting, but seems to me it should do the very same thing as |
I think stopping a database if running makes a lot of sense. with a subcase of I will push a change with the latter implemented. EDIT: after implementing the error:
I don't see an easy way to omit that error message though :(. |
Uhm, the error is coming from
to something like:
so that it is clear that the message is not an error for Then the |
To start with, I am ok with the output as is. Although a bit strange in our workflow, there is nothing problematic with the message. I would refrain from routing the message to stderr, as it is not really an error. Better to keep it on stdout for now. That said, it is a bit strange in UX that it would only say something about the old version when switching. Not to say I would want to add more output telling what the new version is. In general I would expect tools to be quiet when things simply work. And only provide information if it needed to course correct to make it work. eg. instead of logging that postgres wasn't running on the old version I would only tell the user we have detected the old version was running and we are shutting it down. This provides good insights in what the tool was doing, not wat it was not doing. However this would change the normal workflow for people being used to the Lets merge this as is, and see what others think about its chattyness. |
Well, I'm fine with removing messages that told "something did not happen" in favor of what "did happen". I think this can be merged, and imrpove the messaging later. The only doubt I've is if we need to work on messaging before the new release is done. @theory are you okay with this? |
Maybe emit the message only when in a verbose or debugging mode? |
@thanodnl would you mind fixing the documentation as suggested and resolving the pending comments, then we can squash and merge. |
I don't see any suggestions in this thread, am I simply not seeing them? Or could it be you have unsubmitted comments on the PR? Once I know what to fix I will do so happily! |
Uhm, I see a couple of pending comments regarding documentation. It could be that the approval has removed these comments on your side? |
README.md
Outdated
@@ -570,6 +587,7 @@ $ pgenv help | |||
Usage: pgenv <command> [<args>] | |||
|
|||
The pgenv commands are: | |||
switch Set the current PostgreSQL version |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would "group" switch
with clear
and start
with use
. The former two are related to symlink management, the latters are related to runtime.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense to me, I have re-arranged use
/start
/stop
/restart
to be together for that reason, and moved, switch
/clear
below that section.
see discussion <theory#53 (comment)>. If the server is not running and a `stop` command is issued, the program should not print a verbose message to the terminal indicating to the user that the server was not runnig. The output should appear only if the user is in debug mode (PGENV_DEBUG has a value).
Sorry @thanodnl , my fault! Now you should be able to proceed to changes. |
The switch command acts mostly like use, however, it does not manage any database for you, it simply changes the version linked and thus in the path of the user.
39b3b32
to
e3072a5
Compare
Thnaks @thanodnl |
The
switch
command acts mostly likeuse
, however, it does not manage any database for you, it simply changes the version linked and thus in the path of the user.When developing the citus extension for postgres we often need to manage many different postgres databases running on the same machine (different ports) at once. We have our own tooling to create these databases from the postgres version installed on the path.
By omitting the starting, stopping and initializing of the database we can still use
pgenv
to manage different versions of postgres on the same machine.Last years we used a fork of
pgenv
with some more functionality hacked in. Over time most of that functionality have been better implemented by thepgenv
community. The last missing piece for now is a lightweight way of switching which postgres version is on the path without managing a database.