Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nao1215/gup
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.27.2
Choose a base ref
...
head repository: nao1215/gup
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Jun 26, 2024

  1. Output current rather than latest version in up-to-date messages

    Latest can actually be older than current, especially when comparing a
    snapshot against the latest release, and current is what was compared
    against latest anyway.
    
    While at it, add a test case for similar occurrence with Go versions
    (they were already showing correct info though).
    scop committed Jun 26, 2024
    Copy the full SHA
    4c28986 View commit details

Commits on Jun 27, 2024

  1. Merge pull request #164 from scop/fix/current-uptodate-version

    Output current rather than latest version in up-to-date messages
    nao1215 authored Jun 27, 2024
    Copy the full SHA
    4f0f644 View commit details

Commits on Jul 9, 2024

  1. Bump github.com/adrg/xdg from 0.4.0 to 0.5.0

    Bumps [github.com/adrg/xdg](https://github.com/adrg/xdg) from 0.4.0 to 0.5.0.
    - [Release notes](https://github.com/adrg/xdg/releases)
    - [Commits](adrg/xdg@v0.4.0...v0.5.0)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/adrg/xdg
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jul 9, 2024
    Copy the full SHA
    9bf5457 View commit details
  2. Merge pull request #165 from nao1215/dependabot/go_modules/github.com…

    …/adrg/xdg-0.5.0
    
    Bump github.com/adrg/xdg from 0.4.0 to 0.5.0
    nao1215 authored Jul 9, 2024
    Copy the full SHA
    355d386 View commit details

Commits on Jul 11, 2024

  1. Update README

    nao1215 committed Jul 11, 2024
    Copy the full SHA
    d927d6e View commit details
  2. Copy the full SHA
    7d658a0 View commit details
  3. Merge pull request #166 from nao1215/nchika/update-readme

    Update README
    nao1215 authored Jul 11, 2024
    Copy the full SHA
    70c6619 View commit details

Commits on Aug 5, 2024

  1. Bump golang.org/x/sync from 0.7.0 to 0.8.0

    Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.7.0 to 0.8.0.
    - [Commits](golang/sync@v0.7.0...v0.8.0)
    
    ---
    updated-dependencies:
    - dependency-name: golang.org/x/sync
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Aug 5, 2024
    Copy the full SHA
    f447c47 View commit details

Commits on Aug 9, 2024

  1. Merge pull request #167 from nao1215/dependabot/go_modules/golang.org…

    …/x/sync-0.8.0
    
    Bump golang.org/x/sync from 0.7.0 to 0.8.0
    nao1215 authored Aug 9, 2024
    Copy the full SHA
    9c33971 View commit details

Commits on Aug 10, 2024

  1. Copy the full SHA
    406d3a8 View commit details
  2. Merge pull request #169 from nao1215/nchika/shipping-completion

    Feat: Integrate completions into Homebrew formula (Issue #168)
    nao1215 authored Aug 10, 2024
    Copy the full SHA
    86c37d1 View commit details

Commits on Aug 25, 2024

  1. Add go 1.23

    nao1215 committed Aug 25, 2024
    Copy the full SHA
    6312b97 View commit details
  2. Merge pull request #170 from nao1215/nchika/add-go1.23

    Add go 1.23 in unit test coverage
    nao1215 authored Aug 25, 2024
    Copy the full SHA
    d8ef07e View commit details

Commits on Sep 10, 2024

  1. Copy the full SHA
    f741a8d View commit details
  2. Merge pull request #172 from nao1215/nchika/issue-171

    Fix: check sub command print incorrect path.
    nao1215 authored Sep 10, 2024
    Copy the full SHA
    afe73b1 View commit details

Commits on Oct 17, 2024

  1. Bump github.com/adrg/xdg from 0.5.0 to 0.5.1

    Bumps [github.com/adrg/xdg](https://github.com/adrg/xdg) from 0.5.0 to 0.5.1.
    - [Release notes](https://github.com/adrg/xdg/releases)
    - [Commits](adrg/xdg@v0.5.0...v0.5.1)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/adrg/xdg
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Oct 17, 2024
    Copy the full SHA
    7972028 View commit details

Commits on Oct 19, 2024

  1. Merge pull request #174 from nao1215/dependabot/go_modules/github.com…

    …/adrg/xdg-0.5.1
    
    Bump github.com/adrg/xdg from 0.5.0 to 0.5.1
    nao1215 authored Oct 19, 2024
    Copy the full SHA
    5066de6 View commit details

Commits on Oct 22, 2024

  1. Bump github.com/fatih/color from 1.17.0 to 1.18.0

    Bumps [github.com/fatih/color](https://github.com/fatih/color) from 1.17.0 to 1.18.0.
    - [Release notes](https://github.com/fatih/color/releases)
    - [Commits](fatih/color@v1.17.0...v1.18.0)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/fatih/color
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Oct 22, 2024
    Copy the full SHA
    e078adc View commit details

Commits on Oct 24, 2024

  1. Merge pull request #175 from nao1215/dependabot/go_modules/github.com…

    …/fatih/color-1.18.0
    
    Bump github.com/fatih/color from 1.17.0 to 1.18.0
    nao1215 authored Oct 24, 2024
    Copy the full SHA
    0820a8a View commit details

Commits on Oct 29, 2024

  1. Bump github.com/adrg/xdg from 0.5.1 to 0.5.2

    Bumps [github.com/adrg/xdg](https://github.com/adrg/xdg) from 0.5.1 to 0.5.2.
    - [Release notes](https://github.com/adrg/xdg/releases)
    - [Commits](adrg/xdg@v0.5.1...v0.5.2)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/adrg/xdg
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Oct 29, 2024
    Copy the full SHA
    bc6b835 View commit details

Commits on Oct 30, 2024

  1. Merge pull request #176 from nao1215/dependabot/go_modules/github.com…

    …/adrg/xdg-0.5.2
    
    Bump github.com/adrg/xdg from 0.5.1 to 0.5.2
    nao1215 authored Oct 30, 2024
    Copy the full SHA
    c0b2d20 View commit details

Commits on Oct 31, 2024

  1. Bump github.com/adrg/xdg from 0.5.2 to 0.5.3

    Bumps [github.com/adrg/xdg](https://github.com/adrg/xdg) from 0.5.2 to 0.5.3.
    - [Release notes](https://github.com/adrg/xdg/releases)
    - [Commits](adrg/xdg@v0.5.2...v0.5.3)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/adrg/xdg
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Oct 31, 2024
    Copy the full SHA
    d565af3 View commit details

Commits on Nov 1, 2024

  1. Merge pull request #177 from nao1215/dependabot/go_modules/github.com…

    …/adrg/xdg-0.5.3
    
    Bump github.com/adrg/xdg from 0.5.2 to 0.5.3
    nao1215 authored Nov 1, 2024
    Copy the full SHA
    fd5cbcf View commit details

Commits on Nov 7, 2024

  1. Bump golang.org/x/sync from 0.8.0 to 0.9.0

    Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.8.0 to 0.9.0.
    - [Commits](golang/sync@v0.8.0...v0.9.0)
    
    ---
    updated-dependencies:
    - dependency-name: golang.org/x/sync
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Nov 7, 2024
    Copy the full SHA
    baf4e50 View commit details

Commits on Nov 12, 2024

  1. Merge pull request #178 from nao1215/dependabot/go_modules/golang.org…

    …/x/sync-0.9.0
    
    Bump golang.org/x/sync from 0.8.0 to 0.9.0
    nao1215 authored Nov 12, 2024
    Copy the full SHA
    7ca6baa View commit details

Commits on Dec 4, 2024

  1. Bump golang.org/x/sync from 0.9.0 to 0.10.0

    Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.9.0 to 0.10.0.
    - [Commits](golang/sync@v0.9.0...v0.10.0)
    
    ---
    updated-dependencies:
    - dependency-name: golang.org/x/sync
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Dec 4, 2024
    Copy the full SHA
    e98273b View commit details

Commits on Dec 12, 2024

  1. Merge pull request #179 from nao1215/dependabot/go_modules/golang.org…

    …/x/sync-0.10.0
    
    Bump golang.org/x/sync from 0.9.0 to 0.10.0
    nao1215 authored Dec 12, 2024
    Copy the full SHA
    fc7711e View commit details

Commits on Jan 10, 2025

  1. Bump github.com/mattn/go-colorable from 0.1.13 to 0.1.14

    Bumps [github.com/mattn/go-colorable](https://github.com/mattn/go-colorable) from 0.1.13 to 0.1.14.
    - [Commits](mattn/go-colorable@v0.1.13...v0.1.14)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/mattn/go-colorable
      dependency-type: direct:production
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jan 10, 2025
    Copy the full SHA
    876a487 View commit details

Commits on Jan 13, 2025

  1. Merge pull request #180 from nao1215/dependabot/go_modules/github.com…

    …/mattn/go-colorable-0.1.14
    
    Bump github.com/mattn/go-colorable from 0.1.13 to 0.1.14
    nao1215 authored Jan 13, 2025
    Copy the full SHA
    72e2135 View commit details

Commits on Feb 4, 2025

  1. Bump golang.org/x/sync from 0.10.0 to 0.11.0

    Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.10.0 to 0.11.0.
    - [Commits](golang/sync@v0.10.0...v0.11.0)
    
    ---
    updated-dependencies:
    - dependency-name: golang.org/x/sync
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Feb 4, 2025
    Copy the full SHA
    a6001bf View commit details

Commits on Feb 8, 2025

  1. Merge pull request #181 from nao1215/dependabot/go_modules/golang.org…

    …/x/sync-0.11.0
    
    Bump golang.org/x/sync from 0.10.0 to 0.11.0
    nao1215 authored Feb 8, 2025
    Copy the full SHA
    a938d8f View commit details

Commits on Feb 13, 2025

  1. Add go 1.24

    nao1215 authored Feb 13, 2025
    Copy the full SHA
    7393531 View commit details
  2. Fix broken unit test

    nao1215 committed Feb 13, 2025
    Copy the full SHA
    eac6855 View commit details
  3. Merge pull request #182 from nao1215/nao1215-patch-4

    Add go 1.24
    nao1215 authored Feb 13, 2025
    Copy the full SHA
    0832369 View commit details

Commits on Feb 17, 2025

  1. Bump github.com/spf13/cobra from 1.8.1 to 1.9.1

    Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.8.1 to 1.9.1.
    - [Release notes](https://github.com/spf13/cobra/releases)
    - [Commits](spf13/cobra@v1.8.1...v1.9.1)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/spf13/cobra
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Feb 17, 2025
    Copy the full SHA
    bf7f1e2 View commit details
  2. Merge pull request #183 from nao1215/dependabot/go_modules/github.com…

    …/spf13/cobra-1.9.1
    
    Bump github.com/spf13/cobra from 1.8.1 to 1.9.1
    nao1215 authored Feb 17, 2025
    Copy the full SHA
    4cc481b View commit details

Commits on Feb 24, 2025

  1. Bump github.com/google/go-cmp from 0.6.0 to 0.7.0

    Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.6.0 to 0.7.0.
    - [Release notes](https://github.com/google/go-cmp/releases)
    - [Commits](google/go-cmp@v0.6.0...v0.7.0)
    
    ---
    updated-dependencies:
    - dependency-name: github.com/google/go-cmp
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Feb 24, 2025
    Copy the full SHA
    e8dc1d8 View commit details
  2. Copy the full SHA
    ac99a59 View commit details
  3. Merge pull request #184 from nao1215/dependabot/go_modules/github.com…

    …/google/go-cmp-0.7.0
    
    Bump github.com/google/go-cmp from 0.6.0 to 0.7.0
    nao1215 authored Feb 24, 2025
    Copy the full SHA
    fa82f58 View commit details
Showing with 206 additions and 100 deletions.
  1. +2 −1 .github/workflows/unit_test.yml
  2. +1 −0 .gitignore
  3. +23 −1 .goreleaser.yml
  4. +54 −54 README.md
  5. +1 −1 cmd/check.go
  6. +1 −1 cmd/root_test.go
  7. BIN doc/img/sample.png
  8. +12 −10 go.mod
  9. +21 −26 go.sum
  10. +4 −2 internal/cmdinfo/cmdinfo.go
  11. +2 −2 internal/goutil/examples_test.go
  12. +2 −2 internal/goutil/goutil.go
  13. +73 −0 internal/goutil/goutil_test.go
  14. +10 −0 scripts/completions.sh
3 changes: 2 additions & 1 deletion .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -19,9 +19,10 @@ jobs:
- "macos-latest"
go:
- "1"
- "1.24"
- "1.23"
- "1.22"
- "1.21"
- "1.20"
fail-fast: false
runs-on: ${{ matrix.os }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -16,3 +16,4 @@
gup
dist
cover.*
/completions
24 changes: 23 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ before:
hooks:
- go mod tidy
- go generate ./...
- ./scripts/completions.sh
builds:
- main: .
ldflags:
@@ -20,6 +21,8 @@ archives:
format_overrides:
- goos: windows
format: zip
files:
- completions/*
checksum:
name_template: "checksums.txt"
snapshot:
@@ -31,14 +34,27 @@ changelog:
- "^docs:"
- "^test:"
nfpms:
- maintainer: Naohiro CHIKAMATSU <n.chika156@gmail.com>
- maintainer: 'Naohiro CHIKAMATSU <n.chika156@gmail.com>'
description: gup - Update binaries installed by 'go install'
homepage: https://github.com/nao1215/gup
license: Apache License 2.0
formats:
- deb
- rpm
- apk
contents:
- src: ./completions/gup.bash
dst: /usr/share/bash-completion/completions/gup
file_info:
mode: 0644
- src: ./completions/gup.fish
dst: /usr/share/fish/vendor_completions.d/gup.fish
file_info:
mode: 0644
- src: ./completions/gup.zsh
dst: /usr/share/zsh/vendor-completions/_gup
file_info:
mode: 0644
brews:
- name: gup
description: gup - Update binaries installed by 'go install'
@@ -47,3 +63,9 @@ brews:
owner: nao1215
name: homebrew-tap
token: "{{ .Env.TAP_GITHUB_TOKEN }}"
# Ref. https://carlosbecker.com/posts/golang-completions-cobra/
install: |-
bin.install "gup"
bash_completion.install "completions/gup.bash" => "gup"
zsh_completion.install "completions/gup.zsh" => "gup"
fish_completion.install "completions/gup.fish"
108 changes: 54 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
@@ -11,13 +11,13 @@
[[日本語](./doc/ja/README.md)]

# gup - Update binaries installed by "go install"
![demo](./doc/img/demo.gif)

![sample](./doc/img/sample.png)

**gup** command update binaries installed by "go install" to the latest version. gup updates all binaries in parallel, so very fast. It also provides subcommands for manipulating binaries under \$GOPATH/bin (\$GOBIN). It is a cross-platform software that runs on Windows, Mac and Linux.

If you are using oh-my-zsh, then gup has an alias set up. The alias is `gup - git pull --rebase`. Therefore, please make sure that the oh-my-zsh alias is disabled (e.g. $ \gup update).

![sample](./doc/img/sample.png)

## Supported OS (unit testing with GitHub Actions)
- Linux
@@ -44,39 +44,39 @@ brew install nao1215/tap/gup
### Update all binaries
If you update all binaries, you just run `$ gup update`.

```
```shell
$ gup update
gup:INFO : update binary under $GOPATH/bin or $GOBIN
gup:INFO : [ 1/30] github.com/cheat/cheat/cmd/cheat (Already up-to-date: v0.0.0-20211009161301-12ffa4cb5c87 / go1.22.4)
gup:INFO : [ 2/30] fyne.io/fyne/v2/cmd/fyne_demo (Already up-to-date: v2.1.3 / go1.22.4)
gup:INFO : [ 3/30] github.com/nao1215/gal/cmd/gal (v1.0.0 to v1.2.0 / go1.22.4)
gup:INFO : [ 4/30] github.com/matsuyoshi30/germanium/cmd/germanium (Already up-to-date: v1.2.2 / go1.22.4)
gup:INFO : [ 5/30] github.com/onsi/ginkgo/ginkgo (Already up-to-date: v1.16.5 / go1.22.4)
gup:INFO : [ 6/30] github.com/git-chglog/git-chglog/cmd/git-chglog (Already up-to-date: v0.15.1 / go1.22.4)
update binary under $GOPATH/bin or $GOBIN
[ 1/30] github.com/cheat/cheat/cmd/cheat (Already up-to-date: v0.0.0-20211009161301-12ffa4cb5c87 / go1.22.4)
[ 2/30] fyne.io/fyne/v2/cmd/fyne_demo (Already up-to-date: v2.1.3 / go1.22.4)
[ 3/30] github.com/nao1215/gal/cmd/gal (v1.0.0 to v1.2.0 / go1.22.4)
[ 4/30] github.com/matsuyoshi30/germanium/cmd/germanium (Already up-to-date: v1.2.2 / go1.22.4)
[ 5/30] github.com/onsi/ginkgo/ginkgo (Already up-to-date: v1.16.5 / go1.22.4)
[ 6/30] github.com/git-chglog/git-chglog/cmd/git-chglog (Already up-to-date: v0.15.1 / go1.22.4)
:
:
```

### Update the specified binary
If you want to update only the specified binaries, you specify multiple command names separated by space.
```
```shell
$ gup update subaru gup ubume
gup:INFO : update binary under $GOPATH/bin or $GOBIN
gup:INFO : [1/3] github.com/nao1215/gup (v0.7.0 to v0.7.1, go1.20.1 to go1.22.4)
gup:INFO : [2/3] github.com/nao1215/subaru (Already up-to-date: v1.0.2 / go1.22.4)
gup:INFO : [3/3] github.com/nao1215/ubume/cmd/ubume (Already up-to-date: v1.4.1 / go1.22.4)
update binary under $GOPATH/bin or $GOBIN
[1/3] github.com/nao1215/gup (v0.7.0 to v0.7.1, go1.20.1 to go1.22.4)
[2/3] github.com/nao1215/subaru (Already up-to-date: v1.0.2 / go1.22.4)
[3/3] github.com/nao1215/ubume/cmd/ubume (Already up-to-date: v1.4.1 / go1.22.4)
```

### Exclude binaries during gup update
If you don't want to update some binaries simply specify binaries which should not be updated separated using ',' without spaces as a delimiter.
Also works in combination with --dry-run
```
```shell
$ gup update --exclude=gopls,golangci-lint //--exclude or -e, this example will exclude 'gopls' and 'golangci-lint'
```

### Update binaries with @main or @master
If you want to update binaries with @master or @main, you can specify the -m or --master option.
```
```shell
$ gup update --main=gup,lazygit,sqly
```

@@ -86,54 +86,54 @@ list subcommand print command information under $GOPATH/bin or $GOBIN. The outpu

### Remove the specified binary
If you want to remove a command under $GOPATH/bin or $GOBIN, use the remove subcommand. The remove subcommand asks if you want to remove it before removing it.
```
```shell
$ gup remove subaru gal ubume
gup:CHECK: remove /home/nao/.go/bin/subaru? [Y/n] Y
gup:INFO : removed /home/nao/.go/bin/subaru
removed /home/nao/.go/bin/subaru
gup:CHECK: remove /home/nao/.go/bin/gal? [Y/n] n
gup:INFO : cancel removal /home/nao/.go/bin/gal
cancel removal /home/nao/.go/bin/gal
gup:CHECK: remove /home/nao/.go/bin/ubume? [Y/n] Y
gup:INFO : removed /home/nao/.go/bin/ubume
removed /home/nao/.go/bin/ubume
```

If you want to force the removal, use the --force option.
```
```shell
$ gup remove --force gal
gup:INFO : removed /home/nao/.go/bin/gal
removed /home/nao/.go/bin/gal
```

### Check if the binary is the latest version
If you want to know if the binary is the latest version, use the check subcommand. check subcommand checks if the binary is the latest version and displays the name of the binary that needs to be updated.
```
```shell
$ gup check
gup:INFO : check binary under $GOPATH/bin or $GOBIN
gup:INFO : [ 1/33] github.com/cheat/cheat (Already up-to-date: v0.0.0-20211009161301-12ffa4cb5c87 / go1.22.4)
gup:INFO : [ 2/33] fyne.io/fyne/v2 (current: v2.1.3, latest: v2.1.4 / current: go1.20.2, installed: go1.22.4)
check binary under $GOPATH/bin or $GOBIN
[ 1/33] github.com/cheat/cheat (Already up-to-date: v0.0.0-20211009161301-12ffa4cb5c87 / go1.22.4)
[ 2/33] fyne.io/fyne/v2 (current: v2.1.3, latest: v2.1.4 / current: go1.20.2, installed: go1.22.4)
:
gup:INFO : [33/33] github.com/nao1215/ubume (Already up-to-date: v1.5.0 / go1.22.4)
[33/33] github.com/nao1215/ubume (Already up-to-date: v1.5.0 / go1.22.4)

gup:INFO : If you want to update binaries, the following command.
If you want to update binaries, the following command.
$ gup update fyne_demo gup mimixbox
```

Like other subcommands, you can only check the specified binaries.
```
```shell
$ gup check lazygit mimixbox
gup:INFO : check binary under $GOPATH/bin or $GOBIN
gup:INFO : [1/2] github.com/jesseduffield/lazygit (Already up-to-date: v0.32.2 / go1.22.4)
gup:INFO : [2/2] github.com/nao1215/mimixbox (current: v0.32.1, latest: v0.33.2 / go1.22.4)
check binary under $GOPATH/bin or $GOBIN
[1/2] github.com/jesseduffield/lazygit (Already up-to-date: v0.32.2 / go1.22.4)
[2/2] github.com/nao1215/mimixbox (current: v0.32.1, latest: v0.33.2 / go1.22.4)

gup:INFO : If you want to update binaries, the following command.
If you want to update binaries, the following command.
$ gup update mimixbox
```
### Export/Import subcommand
You use the export/import subcommand if you want to install the same golang binaries across multiple systems. By default, export-subcommand exports the file to $XDG_CONFIG_HOME/gup/gup.conf. If you want to know [XDG Base Directory Specification](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html), see this link. After you have placed gup.conf in the same path hierarchy on another system, you execute import-subcommand. gup start the installation
according to the contents of gup.conf.

```
```shell
※ Environments A (e.g. ubuntu)
$ gup export
gup:INFO: Export /home/nao/.config/gup/gup.conf
Export /home/nao/.config/gup/gup.conf

※ Environments B (e.g. debian)
$ ls /home/nao/.config/gup/gup.conf
@@ -142,7 +142,7 @@ $ gup import
```

Alternatively, export subcommand print package information (it's same as gup.conf) that you want to export at STDOUT if you use --output option. import subcommand can also specify the gup.conf file path if you use --input option.
```
```shell
※ Environments A (e.g. ubuntu)
$ gup export --output > gup.conf

@@ -152,34 +152,34 @@ $ gup import --input=gup.conf

### Generate man-pages (for linux, mac)
man subcommand generates man-pages under /usr/share/man/man1.
```
```shell
$ sudo gup man
gup:INFO : Generate /usr/share/man/man1/gup-bug-report.1.gz
gup:INFO : Generate /usr/share/man/man1/gup-check.1.gz
gup:INFO : Generate /usr/share/man/man1/gup-completion.1.gz
gup:INFO : Generate /usr/share/man/man1/gup-export.1.gz
gup:INFO : Generate /usr/share/man/man1/gup-import.1.gz
gup:INFO : Generate /usr/share/man/man1/gup-list.1.gz
gup:INFO : Generate /usr/share/man/man1/gup-man.1.gz
gup:INFO : Generate /usr/share/man/man1/gup-remove.1.gz
gup:INFO : Generate /usr/share/man/man1/gup-update.1.gz
gup:INFO : Generate /usr/share/man/man1/gup-version.1.gz
gup:INFO : Generate /usr/share/man/man1/gup.1.gz
Generate /usr/share/man/man1/gup-bug-report.1.gz
Generate /usr/share/man/man1/gup-check.1.gz
Generate /usr/share/man/man1/gup-completion.1.gz
Generate /usr/share/man/man1/gup-export.1.gz
Generate /usr/share/man/man1/gup-import.1.gz
Generate /usr/share/man/man1/gup-list.1.gz
Generate /usr/share/man/man1/gup-man.1.gz
Generate /usr/share/man/man1/gup-remove.1.gz
Generate /usr/share/man/man1/gup-update.1.gz
Generate /usr/share/man/man1/gup-version.1.gz
Generate /usr/share/man/man1/gup.1.gz
```

### Generate shell completion file (for bash, zsh, fish)
completion subcommand generates shell completion files for bash, zsh, and fish. If the shell completion file does not exist in the system, the generation process will begin. To activate the completion feature, restart the shell.

```
```shell
$ gup completion
gup:INFO : create bash-completion file: /home/nao/.bash_completion
gup:INFO : create fish-completion file: /home/nao/.config/fish/completions/gup.fish
gup:INFO : create zsh-completion file: /home/nao/.zsh/completion/_gup
create bash-completion file: /home/nao/.bash_completion
create fish-completion file: /home/nao/.config/fish/completions/gup.fish
create zsh-completion file: /home/nao/.zsh/completion/_gup
```

### Desktop notification
If you use gup with --notify option, gup command notify you on your desktop whether the update was successful or unsuccessful after the update was finished.
```
```shell
$ gup update --notify
```
![success](./doc/img/notify_success.png)
2 changes: 1 addition & 1 deletion cmd/check.go
Original file line number Diff line number Diff line change
@@ -118,7 +118,7 @@ func doCheck(pkgs []goutil.Package, cpus int) int {
v := <-ch
if v.err == nil {
print.Info(fmt.Sprintf(countFmt+" %s (%s)",
i+1, len(pkgs), v.pkg.ModulePath, v.pkg.VersionCheckResultStr()))
i+1, len(pkgs), v.pkg.ImportPath, v.pkg.VersionCheckResultStr()))
} else {
result = 1
print.Err(fmt.Errorf(countFmt+"%s", i+1, len(pkgs), v.err.Error()))
2 changes: 1 addition & 1 deletion cmd/root_test.go
Original file line number Diff line number Diff line change
@@ -104,7 +104,7 @@ func TestExecute_Version(t *testing.T) {
{
name: "success",
args: []string{"gup", "version"},
stdout: []string{"gup version (under Apache License version 2.0)", ""},
stdout: []string{"gup version (devel) (under Apache License version 2.0)", ""},
},
}
for _, tt := range tests {
Binary file modified doc/img/sample.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 12 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
module github.com/nao1215/gup

go 1.20
go 1.21

toolchain go1.24.0

require (
github.com/adrg/xdg v0.4.0
github.com/fatih/color v1.17.0
github.com/adrg/xdg v0.5.3
github.com/fatih/color v1.18.0
github.com/gen2brain/beeep v0.0.0-20220909211152-5a9ec94374f6
github.com/google/go-cmp v0.6.0
github.com/google/go-cmp v0.7.0
github.com/hashicorp/go-version v1.7.0
github.com/mattn/go-colorable v0.1.13
github.com/mattn/go-colorable v0.1.14
github.com/nao1215/gorky v0.2.1
github.com/pkg/errors v0.9.1
github.com/shogo82148/pointer v1.3.0
github.com/spf13/cobra v1.8.1
github.com/spf13/cobra v1.9.1
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
golang.org/x/sync v0.7.0
golang.org/x/sync v0.11.0
)

require (
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/sys v0.29.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
47 changes: 21 additions & 26 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
github.com/adrg/xdg v0.4.0 h1:RzRqFcjH4nE5C6oTAxhBtoE2IRyjBSa62SCbyPidvls=
github.com/adrg/xdg v0.4.0/go.mod h1:N6ag73EX4wyxeaoeHctc1mas01KZgsj5tYiAIwqJE/E=
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/adrg/xdg v0.5.3 h1:xRnxJXne7+oWDatRhR1JLnvuccuIeCoBu2rtuLqQB78=
github.com/adrg/xdg v0.5.3/go.mod h1:nlTsY+NNiCBGCK2tpm09vRqfVzrc2fLmXGpBLF0zlTQ=
github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4=
github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/gen2brain/beeep v0.0.0-20220909211152-5a9ec94374f6 h1:jFEK/SA/7E8lg9T33+y8D4Z0I782+bbiEjmyyklRzRQ=
github.com/gen2brain/beeep v0.0.0-20220909211152-5a9ec94374f6/go.mod h1:/WeFVhhxMOGypVKS0w8DUJxUBbHypnWkUVnW7p5c9Pw=
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 h1:qZNfIGkIANxGv/OqtnntR4DfOY2+BgwR60cAcu/i3SE=
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4/go.mod h1:kW3HQ4UdaAyrUCSSDR4xUzBKW6O2iA4uHhk7AtyYp10=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY=
github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/nao1215/gorky v0.2.1 h1:kxXYhCNBbtGru9CCSYx+QC0JZfZJ1csY3uLbb5n2WKA=
@@ -35,27 +34,23 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shogo82148/pointer v1.3.0 h1:LW5V2jUAjFNjS8e7k/PgFoh3EavOSB/vvN85aGue5+I=
github.com/shogo82148/pointer v1.3.0/go.mod h1:agZ5JFpavFPXznbWonIvbG78NDfvDTFppe+7o53up5w=
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo=
github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0=
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af h1:6yITBqGTE2lEeTPG04SN9W+iWHCRyHqlVYILiSXziwk=
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w=
golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
6 changes: 4 additions & 2 deletions internal/cmdinfo/cmdinfo.go
Original file line number Diff line number Diff line change
@@ -14,11 +14,13 @@ const Name = "gup"
// GetVersion return gup command version.
// Version global variable is set by ldflags.
func GetVersion() string {
version := "unknown"
version := "(devel)"
if Version != "" {
version = Version
} else if buildInfo, ok := debug.ReadBuildInfo(); ok {
version = buildInfo.Main.Version
if buildInfo.Main.Version != "" {
version = buildInfo.Main.Version
}
}
return fmt.Sprintf("%s version %s (under Apache License version 2.0)", Name, version)
}
4 changes: 2 additions & 2 deletions internal/goutil/examples_test.go
Original file line number Diff line number Diff line change
@@ -139,7 +139,7 @@ func ExampleGoBin() {
// Output: Example GoBin: OK
}

func ExampleInstall() {
func ExampleInstallLatest() {
// Install installs an executable from a Go package.
err := goutil.InstallLatest("example.com/unknown_user/unknown_package")

@@ -160,7 +160,7 @@ func ExampleInstall() {
// Output: Example Install: OK
}

func ExampleIsAlreadyUpToDate() {
func ExamplePackage_IsAlreadyUpToDate() {
// Create Version object with Current and Latest package and Go versions
ver := goutil.Version{
Current: "v1.9.0",
4 changes: 2 additions & 2 deletions internal/goutil/goutil.go
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@ func (p *Package) SetLatestVer() {
// CurrentToLatestStr returns string about the current version and the latest version
func (p *Package) CurrentToLatestStr() string {
if p.IsAlreadyUpToDate() {
return "Already up-to-date: " + color.GreenString(p.Version.Latest) + " / " + color.GreenString(p.GoVersion.Current)
return "Already up-to-date: " + color.GreenString(p.Version.Current) + " / " + color.GreenString(p.GoVersion.Current)
}
var ret string
if p.Version.Current != p.Version.Latest {
@@ -96,7 +96,7 @@ func (p *Package) CurrentToLatestStr() string {
// VersionCheckResultStr returns string about command version check.
func (p *Package) VersionCheckResultStr() string {
if p.IsAlreadyUpToDate() {
return "Already up-to-date: " + color.GreenString(p.Version.Latest) + " / " + color.GreenString(p.GoVersion.Current)
return "Already up-to-date: " + color.GreenString(p.Version.Current) + " / " + color.GreenString(p.GoVersion.Current)
}
var ret string
// TODO: yellow only if latest > current
73 changes: 73 additions & 0 deletions internal/goutil/goutil_test.go
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import (
"errors"
"os"
"path/filepath"
"regexp"
"runtime"
"strings"
"testing"
@@ -673,6 +674,30 @@ func TestGoPaths_StartDryRunMode_fail_if_key_not_set(t *testing.T) {
// Type: Package
// ----------------------------------------------------------------------------

func TestPackage_CurrentToLatestStr_up_to_date(t *testing.T) {
pkgInfo := Package{
Name: "foo",
ImportPath: "github.com/dummy_name/dummy",
ModulePath: "github.com/dummy_name/dummy/foo",
Version: &Version{
Current: "v1.42.2",
Latest: "v1.9.1",
},
GoVersion: &Version{
Current: "go1.22.4",
Latest: "go1.22.4",
},
}

// Assert to contain the expected message
wantContain := "up-to-date: v1.42.2"
got := pkgInfo.CurrentToLatestStr()

if !strings.Contains(got, wantContain) {
t.Errorf("got: %v, want: %v", got, wantContain)
}
}

func TestPackage_CurrentToLatestStr_not_up_to_date(t *testing.T) {
pkgInfo := Package{
Name: "foo",
@@ -697,6 +722,30 @@ func TestPackage_CurrentToLatestStr_not_up_to_date(t *testing.T) {
}
}

func TestPackage_VersionCheckResultStr_up_to_date(t *testing.T) {
pkgInfo := Package{
Name: "foo",
ImportPath: "github.com/dummy_name/dummy",
ModulePath: "github.com/dummy_name/dummy/foo",
Version: &Version{
Current: "v2.5.0",
Latest: "v1.9.1",
},
GoVersion: &Version{
Current: "go1.22.4",
Latest: "go1.22.4",
},
}

// Assert to contain the expected message
wantContain := "up-to-date: v2.5.0"
got := pkgInfo.VersionCheckResultStr()

if !strings.Contains(got, wantContain) {
t.Errorf("got: %v, want: %v", got, wantContain)
}
}

func TestPackage_VersionCheckResultStr_not_up_to_date(t *testing.T) {
pkgInfo := Package{
Name: "foo",
@@ -721,6 +770,30 @@ func TestPackage_VersionCheckResultStr_not_up_to_date(t *testing.T) {
}
}

func TestPackage_VersionCheckResultStr_go_up_to_date(t *testing.T) {
pkgInfo := Package{
Name: "foo",
ImportPath: "github.com/dummy_name/dummy",
ModulePath: "github.com/dummy_name/dummy/foo",
Version: &Version{
Current: "v1.9.1",
Latest: "v1.9.1",
},
GoVersion: &Version{
Current: "go1.99.9",
Latest: "go1.22.4",
},
}

// Assert to contain the expected message
wantContain := regexp.MustCompile(`up-to-date:.* go1\.99\.9`)
got := pkgInfo.VersionCheckResultStr()

if !wantContain.MatchString(got) {
t.Errorf("got: %v, want: %v", got, wantContain)
}
}

func TestPackage_VersionCheckResultStr_go_not_up_to_date(t *testing.T) {
pkgInfo := Package{
Name: "foo",
10 changes: 10 additions & 0 deletions scripts/completions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
# scripts/completions.sh
set -eux

rm -rf completions
mkdir completions

for sh in bash zsh fish; do
go run main.go completion "$sh" >"completions/gup.$sh"
done