-
Notifications
You must be signed in to change notification settings - Fork 47
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
Feature Request: bin update check mode #83
Comments
I like this. Let's think about how that API would look like. |
Let us take some inspiration from other tools: deb: Judging from the current API, I assume the check mode / dry run to be a special case for the existing If we open up the scope a little bit, the question is, if we want to have a dry run feature for other commands as well (e.g. for If this is not the case, I would propose something like If the command should exit with a non zero exit code when updates are available could potentially be an additional flag (I have seen this with other tools, but from the top of my head I can not recall an example). |
Isn't the default interactive mode of $ : | bin update
• /home/<redacted>/bin/buf v0.39.0 -> v0.40.0 (https://github.com/bufbuild/buf/releases/tag/v0.40.0)
Do you want to continue? [Y/n] ⨯ command failed error=Invalid input
exit status 1
$ echo $?
1
$ bin update
• /home/<redacted>/bin/buf v0.39.0 -> v0.40.0 (https://github.com/bufbuild/buf/releases/tag/v0.40.0)
Do you want to continue? [Y/n] Y
• Getting v0.40.0 release for bufbuild/buf
Multiple matches found, please select one:
[1] buf-Linux-x86_64
[2] buf-Linux-x86_64.tar.gz
[3] protoc-gen-buf-breaking-Linux-x86_64
[4] protoc-gen-buf-check-breaking-Linux-x86_64
[5] protoc-gen-buf-check-lint-Linux-x86_64
[6] protoc-gen-buf-lint-Linux-x86_64
Select an option: 1
• Starting download of https://github.com/bufbuild/buf/releases/download/v0.40.0/buf-Linux-x86_64
16.40 MiB / 16.40 MiB [-----------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% 19.54 MiB p/s 2s
• Copying for buf@v0.40.0 into /home/<redacted>/bin/buf
• Done updating /home/<redacted>/bin/buf to v0.40.0
$ : | bin update
• All binaries are up to date
$ echo $?
0 |
Sort of true and one might also redirect stdout to |
Agree that having a flag for I guess |
Yes, it will definitely be cleaner than my workarounds above. |
* Add dry-run mode to update command Fixes #83 * Update cmd/update.go Co-authored-by: Lucas Bremgartner <breml@users.noreply.github.com> * Return status code 3 for dry-run updates I'm using 3 because 2 is generally reserved for special meanings. Ref: https://tldp.org/LDP/abs/html/exitcodes.html Co-authored-by: Lucas Bremgartner <breml@users.noreply.github.com>
I would like to have a check mode (or dry run mode) for the update command. The command should exit with non 0 exit code, if there are updated version found for any installed binary. If no updates are found, the exit code would be 0 and no output would be printed.
This command I would like to execute on a regular basis (e.g. cron or init of my shell).
Bonus: In order to prevent too frequent requests to e.g. the github API,
bin
could have an option in the config file, how longbin
does cache the results from this check update command. This would allow to run the check update command on every init of my shell (these can happen quite frequently, whenever I open a new pane/window in tmux).The text was updated successfully, but these errors were encountered: