MontFerret / cli

Ferret CLI
Apache License 2.0
17 stars 5 forks source link

add selfupdate cmd #5

Closed 3timeslazy closed 2 years ago

3timeslazy commented 2 years ago

Simple implementation of self-update command. Currently tested on macOS only.

In the process of implementation, I considered ready-made solutions, like go-github-update and go-selfupdate, but in the end I decided not to use them. That is why i decided this way:

To test the feature, do next in shell:

$ go build -ldflags "-X main.version=v1.0.0" ferret/main.go && cp main /usr/local/bin/ferret && ferret version
Version:
  Self: v1.0.0
  Runtime: unknown

$ ferret selfupdate
Looking for a new version for darwin_x86_64
New version of Ferret available!
Update Ferret to v1.1.0
Download checksums and assets
Verify checksum
Uncompress cli_darwin_x86_64.tar.gz
Install new version

$ ferret version
Version:
  Self: 1.1.0
  Runtime: 0.15.0
ziflex commented 2 years ago

Looks good! Could you resolve conflicts?