Skip to content

Commit

Permalink
Specify binary name for checking with --upgrade-only
Browse files Browse the repository at this point in the history
  • Loading branch information
dufferzafar committed May 29, 2022
1 parent 030bdb9 commit a2e5c1f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,9 @@ Application Options:
--all extract all candidate files
-q, --quiet only print essential output
--download-only stop after downloading the asset (no extraction)
--upgrade-only only download if release is more recent than current
version
-a, --asset= download a specific asset containing the given string; can be specified multiple times for additional
filtering
--upgrade-only only download if release is more recent than current version
-b, --binary= binary name of current version
-a, --asset= download a specific asset containing the given string; can be specified multiple times for additional filtering
--sha256 show the SHA-256 hash of the downloaded asset
--verify-sha256= verify the downloaded asset checksum against the one provided
--rate show GitHub API rate limiting information
Expand Down
9 changes: 6 additions & 3 deletions eget.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,12 @@ func getFinder(project string, opts *Flags) (finder Finder, tool string) {

var mint time.Time
if opts.UpgradeOnly {
parts := strings.Split(project, "/")
last := parts[len(parts)-1]
mint = bintime(last)
bin := opts.BinaryName
if bin == "" {
parts := strings.Split(project, "/")
bin = parts[len(parts)-1]
}
mint = bintime(bin)
}

finder = &GithubAssetFinder{
Expand Down
1 change: 1 addition & 0 deletions flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type Flags struct {
Quiet bool `short:"q" long:"quiet" description:"only print essential output"`
DLOnly bool `long:"download-only" description:"stop after downloading the asset (no extraction)"`
UpgradeOnly bool `long:"upgrade-only" description:"only download if release is more recent than current version"`
BinaryName string `short:"b" long:"binary" description:"binary name of current version"`
Asset []string `short:"a" long:"asset" description:"download a specific asset containing the given string; can be specified multiple times for additional filtering"`
Hash bool `long:"sha256" description:"show the SHA-256 hash of the downloaded asset"`
Verify string `long:"verify-sha256" description:"verify the downloaded asset checksum against the one provided"`
Expand Down
4 changes: 4 additions & 0 deletions man/eget.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ header: Eget Manual

: Only download the asset if the release is more recent than an existing asset with the same name in `$EGET_BIN`, or the current directory if `$EGET_BIN` is not defined.

`-b, --binary=`

: Specify asset binary name present in `$EGET_BIN` or current directory. Used with `--upgrade-only` when repo name differs from the binary name.

`-a, --asset=`

: Download a specific asset containing the given string. If there is an exact match with an asset, that asset is used regardless. This option can be specified multiple times for additional filtering. Example: **`eget --asset nvim.appimage neovim/neovim`**. Example **`eget --download-only --asset amd64.deb --asset musl sharkdp/bat`**.
Expand Down

0 comments on commit a2e5c1f

Please sign in to comment.