version icon indicating copy to clipboard operation
version copied to clipboard

Detect installation method when suggesting an upgrade

Open mszostok opened this issue 3 years ago • 2 comments

Description

Add option to detect if CLI was installed via

  • Homebrew
  • apt
  • krew
  • choco

so later the ready to copy-paste command is displayed in upgrade notice, e.g.:

A new release is available: v0.6.1 -> v0.7.4
To upgrade, run: brew upgrade gimme

https://github.com/mszostok/gimme

mszostok avatar Jul 31 '22 17:07 mszostok

This would be really cool! What are your thoughts on allowing developers to configure the upgrade command instead of detecting it?


...

// Example
command :=  "brew upgrade --without-npm gimme"
upgradeOpts := []upgrade.Options{
	upgrade.WithLayout(&style.Layout{
		GoTemplate: forBoxLayoutGoTpl,
	}),
	upgrade.WithPostRenderHook(SprintInBox),
        upgrade.WithCommand(command)
}

// displayed output
A new release is available: v0.6.1 -> v0.7.4
To upgrade, run: brew upgrade --without-npm gimme

https://github.com/mszostok/gimme

Kamsiy avatar Dec 18 '22 21:12 Kamsiy

Adding that shouldn't be a problem 🤔 and it makes sens in some cases 👍

But the only problem is that a single binary can be installed in different ways. For example, k3d: https://k3d.io/v5.4.6/#releases where you can manually download it from GitHub release, or use Homebrew, or Chocolatey.

so if someone will “hard-coded” that in their binary, it can be less useful. Maybe only if they will build a dedicated binary per "release" source 🤔

mszostok avatar Dec 19 '22 10:12 mszostok