Skip to content

Commit

Permalink
Merge pull request #17 from nao1215/improve
Browse files Browse the repository at this point in the history
Improve from "Suggestions for improvements #2"
  • Loading branch information
nao1215 authored Mar 4, 2022
2 parents bc29d6b + 4527922 commit d6e72a1
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 17 deletions.
6 changes: 6 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

# [0.7.0] - 2022-03-04
## Changed
- Removed warning log "gup:WARN : $GOPATH/bin or $GOBIN contains the directory". This log is unnecessary for both developers and users.
- Changed dry run short option from -d to -n
- Changed to be able to update the specified command without the --file option

# [0.6.1] - 2022-02-26
## Changed
- Removed the progress bar being updated
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ gup:INFO : [ 8/29] update success: github.com/shogo82148/goa-v1/goagen
```

### Update the specified binary
If you want to update only the specified binaries, use update subcommand with --file option. You specify multiple command names separated by commas.
If you want to update only the specified binaries, you specify multiple command names separated by space.
```
$ gup update --file=subaru,gup,ubume
$ gup update subaru gup ubume
gup:INFO : update all binary under $GOPATH/bin or $GOBIN
gup:INFO : [1/3] update success: github.com/nao1215/gup
gup:INFO : [2/3] update success: github.com/nao1215/subaru
Expand Down
2 changes: 1 addition & 1 deletion cmd/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Finally, you execute the export subcommand in this state.`,
}

func init() {
importCmd.Flags().BoolP("dry-run", "d", false, "perform the trial update with no changes")
importCmd.Flags().BoolP("dry-run", "n", false, "perform the trial update with no changes")
rootCmd.AddCommand(importCmd)
}

Expand Down
10 changes: 2 additions & 8 deletions cmd/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ under $GOPATH/bin and automatically updates commans to the latest version.`,
}

func init() {
updateCmd.Flags().BoolP("dry-run", "d", false, "perform the trial update with no changes")
updateCmd.Flags().StringSliceP("file", "f", []string{}, "specify binary name to be update (e.g.:--file=subaru,gup,go)")
updateCmd.Flags().BoolP("dry-run", "n", false, "perform the trial update with no changes")
rootCmd.AddCommand(updateCmd)
}

Expand All @@ -37,11 +36,6 @@ func gup(cmd *cobra.Command, args []string) int {
print.Fatal(fmt.Errorf("%s: %w", "can not parse command line argument (--dry-run)", err))
}

targets, err := cmd.Flags().GetStringSlice("file")
if err != nil {
print.Fatal(fmt.Errorf("%s: %w", "can not parse command line argument (--file)", err))
}

if err := goutil.CanUseGoCmd(); err != nil {
print.Fatal(fmt.Errorf("%s: %w", "you didn't install golang", err))
}
Expand All @@ -50,7 +44,7 @@ func gup(cmd *cobra.Command, args []string) int {
if err != nil {
print.Fatal(err)
}
pkgs = extractUserSpecifyPkg(pkgs, targets)
pkgs = extractUserSpecifyPkg(pkgs, args)

if len(pkgs) == 0 {
print.Fatal("unable to update package: no package information")
Expand Down
4 changes: 2 additions & 2 deletions doc/ja/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ gup:INFO: update success: github.com/mgechev/revive
gup:INFO: update success: honnef.co/go/tools/cmd/staticcheck
```
### 指定バイナリのみアップデート
指定のバイナリのみを更新したい場合、updateサブコマンドに--fileオプションを付与してください。--fileオプションでは、複数のコマンド名をカンマ区切りで指定できます
指定のバイナリのみを更新したい場合、updateサブコマンドに複数のコマンド名をスペース区切りで渡してください
```
$ gup update --file=subaru,gup,ubume
$ gup update subaru gup ubume
gup:INFO : update all binary under $GOPATH/bin or $GOBIN
gup:INFO : [1/3] update success: github.com/nao1215/gup
gup:INFO : [2/3] update success: github.com/nao1215/subaru
Expand Down
2 changes: 1 addition & 1 deletion internal/cmdinfo/cmdinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

const (
name = "gup"
version = "0.6.1"
version = "0.7.0"
)

// Version return gup command version.
Expand Down
4 changes: 1 addition & 3 deletions internal/goutil/goutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ func BinaryPathList(path string) ([]string, error) {

list := []string{}
for _, e := range entries {
if e.IsDir() {
print.Warn("$GOPATH/bin or $GOBIN contains the directory")
} else {
if !e.IsDir() {
list = append(list, filepath.Join(path, e.Name()))
}
}
Expand Down

0 comments on commit d6e72a1

Please sign in to comment.