From 38be347f5fb7bd4a6ea1f04071099a501b28d8de Mon Sep 17 00:00:00 2001 From: ForrestSu Date: Sun, 4 Sep 2022 00:22:04 +0800 Subject: [PATCH] feat: default -> set (#43) --- README.md | 2 +- ftest/ftest_test.go | 4 ++-- internal/commands/root.go | 2 +- internal/commands/{default.go => set.go} | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) rename internal/commands/{default.go => set.go} (79%) diff --git a/README.md b/README.md index 5799f96..d4e986d 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ $ GOUP_GO_HOST=golang.google.cn goup install # For Gophers in China, see https:/ * `install.sh` downloads the latest Goup release for your platform and appends Goup's bin directory (`$HOME/.go/bin`) & Go's bin directory (`$HOME/.go/current/bin`) to your PATH environment variable. * `goup` switches to selected Go version. -* `goup default` switches to selected Go version. +* `goup set` switches to selected Go version. * `goup install` downloads specified version of Go to`$HOME/.go/VERSION` and symlinks it to `$HOME/.go/current`. * `goup ls` list all installed Go version located at `$HOME/.go/current`. * `goup remove` removes the specified Go version. diff --git a/ftest/ftest_test.go b/ftest/ftest_test.go index 4e55805..67207af 100644 --- a/ftest/ftest_test.go +++ b/ftest/ftest_test.go @@ -113,8 +113,8 @@ func TestGoup(t *testing.T) { } }) - t.Run("goup default 1.15.2", func(t *testing.T) { - cmd := exec.Command(goupBin, "default", "1.15.2") + t.Run("goup set 1.15.2", func(t *testing.T) { + cmd := exec.Command(goupBin, "set", "1.15.2") execCmd(t, cmd) }) diff --git a/internal/commands/root.go b/internal/commands/root.go index c60a0f0..7c9641c 100644 --- a/internal/commands/root.go +++ b/internal/commands/root.go @@ -43,7 +43,7 @@ func NewCommand() *cobra.Command { rootCmd.PersistentFlags().BoolVarP(&rootCmdVerboseFlag, "verbose", "v", false, "Verbose") rootCmd.AddCommand(installCmd()) - rootCmd.AddCommand(defaultCmd()) + rootCmd.AddCommand(setCmd()) rootCmd.AddCommand(removeCmd()) rootCmd.AddCommand(initCmd()) rootCmd.AddCommand(listCmd()) diff --git a/internal/commands/default.go b/internal/commands/set.go similarity index 79% rename from internal/commands/default.go rename to internal/commands/set.go index 2e8bfd5..f5cfafb 100644 --- a/internal/commands/default.go +++ b/internal/commands/set.go @@ -5,21 +5,21 @@ import ( "github.com/spf13/cobra" ) -func defaultCmd() *cobra.Command { +func setCmd() *cobra.Command { return &cobra.Command{ - Use: "default ...", + Use: "set ...", Short: "Set the default Go version", Long: `Set the default Go version to one specified. If no version is provided, a prompt will show to select a installed Go version.`, Example: ` - goup default # A prompt will show to select a version - goup default 1.15.2 + goup set # A prompt will show to select a version + goup set 1.15.2 `, - RunE: runDefault, + RunE: runSetDefault, } } -func runDefault(cmd *cobra.Command, args []string) error { +func runSetDefault(cmd *cobra.Command, args []string) error { if len(args) > 0 { return switchVer(args[0]) }