From 207db332fa92b31851d8cf606258c269554f1579 Mon Sep 17 00:00:00 2001 From: Rick <1450685+LinuxSuRen@users.noreply.github.com> Date: Thu, 9 Nov 2023 14:28:45 +0800 Subject: [PATCH] change ghproxy.com to gh-proxy.com (#443) --- cmd/root.go | 2 +- cmd/search.go | 2 +- cmd/setup.go | 2 +- pkg/os/generic/common_test.go | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index a6f839e..7341c4e 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -51,7 +51,7 @@ func NewRoot(cxt context.Context) (cmd *cobra.Command) { for _, c := range cmd.Commands() { registerFlagCompletionFunc(c, "provider", ArrayCompletion(ProviderGitHub, ProviderGitee)) registerFlagCompletionFunc(c, "proxy-github", ArrayCompletion("gh.api.99988866.xyz", - "ghproxy.com")) + "gh-proxy.com")) registerFlagCompletionFunc(c, "os", ArrayCompletion("window", "linux", "darwin")) registerFlagCompletionFunc(c, "arch", ArrayCompletion("amd64", "arm64")) registerFlagCompletionFunc(c, "format", ArrayCompletion("tar.gz", "zip", "msi")) diff --git a/cmd/search.go b/cmd/search.go index 7e97cd8..ef1721c 100644 --- a/cmd/search.go +++ b/cmd/search.go @@ -42,7 +42,7 @@ func (s *searchOption) addFlags(flags *pflag.FlagSet) { flags.StringVarP(&s.Provider, "provider", "", viper.GetString("provider"), "The file provider") flags.StringVarP(&s.ProxyGitHub, "proxy-github", "", viper.GetString("proxy-github"), `The proxy address of github.com, the proxy address will be the prefix of the final address. -Available proxy: gh.api.99988866.xyz, ghproxy.com +Available proxy: gh.api.99988866.xyz, gh-proxy.com Thanks to https://github.com/hunshcn/gh-proxy`) } diff --git a/cmd/setup.go b/cmd/setup.go index f0dc14f..d07cb76 100644 --- a/cmd/setup.go +++ b/cmd/setup.go @@ -42,7 +42,7 @@ func (o *setupOption) runE(cmd *cobra.Command, args []string) (err error) { logger := log.GetLoggerFromContextOrDefault(cmd) if o.proxy == "" { - if o.proxy, err = selectFromList([]string{"", "ghproxy.com", "gh.api.99988866.xyz"}, + if o.proxy, err = selectFromList([]string{"", "gh-proxy.com", "gh.api.99988866.xyz"}, o.v.GetString("proxy-github"), "Select proxy-github", o.stdio); err != nil { return diff --git a/pkg/os/generic/common_test.go b/pkg/os/generic/common_test.go index c8f40b9..2d85a6b 100644 --- a/pkg/os/generic/common_test.go +++ b/pkg/os/generic/common_test.go @@ -10,7 +10,7 @@ import ( func TestSliceReplace(t *testing.T) { installer := &CommonInstaller{} installer.SetURLReplace(map[string]string{ - "https://raw.githubusercontent.com": "https://ghproxy.com/https://raw.githubusercontent.com", + "https://raw.githubusercontent.com": "https://gh-proxy.com/https://raw.githubusercontent.com", }) // a normal case @@ -19,7 +19,7 @@ func TestSliceReplace(t *testing.T) { "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh", }) assert.Equal(t, []string{"abc", - "https://ghproxy.com/https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"}, result) + "https://gh-proxy.com/https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"}, result) // an empty slice noProxyInstaller := &CommonInstaller{}