From d2df796b39d55618174479c85abb86c9b7c1205b Mon Sep 17 00:00:00 2001 From: dacheng293 Date: Thu, 21 Nov 2024 14:33:59 -0500 Subject: [PATCH 01/13] fix: remove auth for upgrade cmd and add path option Signed-off-by: dacheng293 --- docs/vcr.md | 2 +- docs/vcr_app.md | 2 +- docs/vcr_app_create.md | 2 +- docs/vcr_app_generate-keys.md | 2 +- docs/vcr_app_list.md | 2 +- docs/vcr_configure.md | 2 +- docs/vcr_debug.md | 2 +- docs/vcr_deploy.md | 2 +- docs/vcr_init.md | 2 +- docs/vcr_instance.md | 2 +- docs/vcr_instance_log.md | 2 +- docs/vcr_instance_remove.md | 2 +- docs/vcr_mongo.md | 2 +- docs/vcr_mongo_create.md | 2 +- docs/vcr_mongo_delete.md | 2 +- docs/vcr_mongo_info.md | 2 +- docs/vcr_mongo_list.md | 2 +- docs/vcr_secret.md | 2 +- docs/vcr_secret_create.md | 2 +- docs/vcr_secret_remove.md | 2 +- docs/vcr_secret_update.md | 2 +- docs/vcr_upgrade.md | 5 +++-- pkg/cmdutil/factory.go | 17 +++++++++++++++++ script/install.sh | 4 +++- testutil/mocks/factory.go | 14 ++++++++++++++ vcr/root/root.go | 15 ++++++++------- vcr/upgrade/upgrade.go | 35 ++++++++++++++++++++++++++++++++++- 27 files changed, 100 insertions(+), 32 deletions(-) diff --git a/docs/vcr.md b/docs/vcr.md index 404a7d0..7ede048 100644 --- a/docs/vcr.md +++ b/docs/vcr.md @@ -43,4 +43,4 @@ $ vcr init * [vcr secret](vcr_secret.md) - Manage VCR secrets * [vcr upgrade](vcr_upgrade.md) - Show and update VCR CLI version -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_app.md b/docs/vcr_app.md index f9ba4ce..a3911a4 100644 --- a/docs/vcr_app.md +++ b/docs/vcr_app.md @@ -26,4 +26,4 @@ Use app commands to create, list and generate the key pairs of Vonage applicatio * [vcr app generate-keys](vcr_app_generate-keys.md) - Generate Vonage application keys * [vcr app list](vcr_app_list.md) - List Vonage applications -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_app_create.md b/docs/vcr_app_create.md index 0055933..bc238cb 100644 --- a/docs/vcr_app_create.md +++ b/docs/vcr_app_create.md @@ -42,4 +42,4 @@ $ vcr app create --name App * [vcr app](vcr_app.md) - Use app commands to manage Vonage applications -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_app_generate-keys.md b/docs/vcr_app_generate-keys.md index 06b031e..bb40f52 100644 --- a/docs/vcr_app_generate-keys.md +++ b/docs/vcr_app_generate-keys.md @@ -44,4 +44,4 @@ $ vcr app generate-keys --app-id 42066b10-c4ae-48a0-addd-feb2bd615a67 * [vcr app](vcr_app.md) - Use app commands to manage Vonage applications -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_app_list.md b/docs/vcr_app_list.md index 3b091a2..4dc1e47 100644 --- a/docs/vcr_app_list.md +++ b/docs/vcr_app_list.md @@ -38,4 +38,4 @@ ID Name * [vcr app](vcr_app.md) - Use app commands to manage Vonage applications -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_configure.md b/docs/vcr_configure.md index 1c42dc9..9f24963 100644 --- a/docs/vcr_configure.md +++ b/docs/vcr_configure.md @@ -39,4 +39,4 @@ $ vcr configure * [vcr](vcr.md) - Streamline your Vonage Cloud Runtime development and management tasks with VCR -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_debug.md b/docs/vcr_debug.md index 94ea62a..d03042f 100644 --- a/docs/vcr_debug.md +++ b/docs/vcr_debug.md @@ -75,4 +75,4 @@ $ vcr debug --name debugger" * [vcr](vcr.md) - Streamline your Vonage Cloud Runtime development and management tasks with VCR -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_deploy.md b/docs/vcr_deploy.md index b8191c8..35caeeb 100644 --- a/docs/vcr_deploy.md +++ b/docs/vcr_deploy.md @@ -85,4 +85,4 @@ $ vcr deploy * [vcr](vcr.md) - Streamline your Vonage Cloud Runtime development and management tasks with VCR -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_init.md b/docs/vcr_init.md index 55401fc..e2999b1 100644 --- a/docs/vcr_init.md +++ b/docs/vcr_init.md @@ -42,4 +42,4 @@ $ vcr init my-app * [vcr](vcr.md) - Streamline your Vonage Cloud Runtime development and management tasks with VCR -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_instance.md b/docs/vcr_instance.md index 4d22a85..15204fd 100644 --- a/docs/vcr_instance.md +++ b/docs/vcr_instance.md @@ -24,4 +24,4 @@ Used for instance management * [vcr instance log](vcr_instance_log.md) - This command will output the log of an instance. * [vcr instance remove](vcr_instance_remove.md) - This command will remove an instance. -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_instance_log.md b/docs/vcr_instance_log.md index f34872f..e07ba22 100644 --- a/docs/vcr_instance_log.md +++ b/docs/vcr_instance_log.md @@ -44,4 +44,4 @@ $ vcr instance log --project-name --instance-name * [vcr instance](vcr_instance.md) - Used for instance management -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_instance_remove.md b/docs/vcr_instance_remove.md index 530965b..8761cc1 100644 --- a/docs/vcr_instance_remove.md +++ b/docs/vcr_instance_remove.md @@ -41,4 +41,4 @@ $ vcr instance rm --id * [vcr instance](vcr_instance.md) - Used for instance management -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_mongo.md b/docs/vcr_mongo.md index aad6547..ce6b3a8 100644 --- a/docs/vcr_mongo.md +++ b/docs/vcr_mongo.md @@ -22,4 +22,4 @@ Used for managing MongoDB databases * [vcr mongo info](vcr_mongo_info.md) - Get database connection info * [vcr mongo list](vcr_mongo_list.md) - List databases -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_mongo_create.md b/docs/vcr_mongo_create.md index 563b7cf..293507d 100644 --- a/docs/vcr_mongo_create.md +++ b/docs/vcr_mongo_create.md @@ -34,4 +34,4 @@ $ vcr mongo create * [vcr mongo](vcr_mongo.md) - Used for managing MongoDB databases -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_mongo_delete.md b/docs/vcr_mongo_delete.md index 43fa302..8bbb2a2 100644 --- a/docs/vcr_mongo_delete.md +++ b/docs/vcr_mongo_delete.md @@ -35,4 +35,4 @@ $ vcr mongo delete --database * [vcr mongo](vcr_mongo.md) - Used for managing MongoDB databases -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_mongo_info.md b/docs/vcr_mongo_info.md index 43709c4..86184f9 100644 --- a/docs/vcr_mongo_info.md +++ b/docs/vcr_mongo_info.md @@ -35,4 +35,4 @@ $ vcr mongo info --database * [vcr mongo](vcr_mongo.md) - Used for managing MongoDB databases -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_mongo_list.md b/docs/vcr_mongo_list.md index 282cebb..b6e201d 100644 --- a/docs/vcr_mongo_list.md +++ b/docs/vcr_mongo_list.md @@ -34,4 +34,4 @@ $ vcr mongo list * [vcr mongo](vcr_mongo.md) - Used for managing MongoDB databases -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_secret.md b/docs/vcr_secret.md index 59a36e3..69cecad 100644 --- a/docs/vcr_secret.md +++ b/docs/vcr_secret.md @@ -29,4 +29,4 @@ $ vcr secret create --name --file * [vcr secret remove](vcr_secret_remove.md) - Remove a secret * [vcr secret update](vcr_secret_update.md) - update a secret -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_secret_create.md b/docs/vcr_secret_create.md index 86a394a..fa5ae1c 100644 --- a/docs/vcr_secret_create.md +++ b/docs/vcr_secret_create.md @@ -46,4 +46,4 @@ $ vcr secret create --name --file * [vcr secret](vcr_secret.md) - Manage VCR secrets -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_secret_remove.md b/docs/vcr_secret_remove.md index fc59007..a629ac4 100644 --- a/docs/vcr_secret_remove.md +++ b/docs/vcr_secret_remove.md @@ -35,4 +35,4 @@ $ vcr secret remove -n * [vcr secret](vcr_secret.md) - Manage VCR secrets -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_secret_update.md b/docs/vcr_secret_update.md index 9542daa..141b121 100644 --- a/docs/vcr_secret_update.md +++ b/docs/vcr_secret_update.md @@ -39,4 +39,4 @@ $ vcr secret update --name my-secret --value changed-value * [vcr secret](vcr_secret.md) - Manage VCR secrets -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/docs/vcr_upgrade.md b/docs/vcr_upgrade.md index 01ba6fe..7db2a71 100644 --- a/docs/vcr_upgrade.md +++ b/docs/vcr_upgrade.md @@ -16,7 +16,8 @@ vcr upgrade [flags] ### Options ``` - -f, --force Force update and skip prompt if new update exists + -p, --directory-path string Path to the VCR CLI installed directory + -f, --force Force update and skip prompt if new update exists ``` ### Options inherited from parent commands @@ -35,4 +36,4 @@ vcr upgrade [flags] * [vcr](vcr.md) - Streamline your Vonage Cloud Runtime development and management tasks with VCR -###### Auto generated by spf13/cobra on 11-Nov-2024 +###### Auto generated by spf13/cobra on 21-Nov-2024 diff --git a/pkg/cmdutil/factory.go b/pkg/cmdutil/factory.go index 6af2beb..f4ef692 100644 --- a/pkg/cmdutil/factory.go +++ b/pkg/cmdutil/factory.go @@ -74,6 +74,7 @@ type DatastoreInterface interface { // Factory provides clients and parameters for all subcommands. type Factory interface { Init(ctx context.Context, cfg config.CLIConfig, opts *config.GlobalOptions) error + InitUpgrade(opts *config.GlobalOptions) error InitDatastore(cfg config.CLIConfig, opts *config.GlobalOptions) InitDeploymentClient(ctx context.Context, regionAlias string) error SetGlobalOptions(opts *config.GlobalOptions) @@ -126,6 +127,7 @@ func NewDefaultFactory(apiVersion string, releaseURL string) *DefaultFactory { } func (f *DefaultFactory) Init(ctx context.Context, cfg config.CLIConfig, opts *config.GlobalOptions) error { + f.cliConfig = cfg f.globalOpts = opts f.websocketConnectionClient = getWebsocketConnectionClient(f.APIKey(), f.APISecret()) @@ -145,6 +147,13 @@ func (f *DefaultFactory) Init(ctx context.Context, cfg config.CLIConfig, opts *c return nil } +func (f *DefaultFactory) InitUpgrade(opts *config.GlobalOptions) error { + f.globalOpts = opts + f.httpClient = GetHTTPClient("", "") + f.releaseClient = api.NewReleaseClient(f.releaseURL, f.httpClient) + return nil +} + func (f *DefaultFactory) InitDatastore(cfg config.CLIConfig, opts *config.GlobalOptions) { f.globalOpts = opts f.cliConfig = cfg @@ -220,6 +229,9 @@ func (f *DefaultFactory) GraphQLURL() string { if f.globalOpts.GraphqlEndpoint != "" { return f.globalOpts.GraphqlEndpoint } + if f.globalOpts.Region != "" { + return makeGraphqlEndpoint(f.globalOpts.Region) + } return f.cliConfig.GraphqlEndpoint } @@ -268,3 +280,8 @@ func getDatastore(graphQLURL string, httpClient *resty.Client) *api.Datastore { func getWebsocketConnectionClient(apiKey, apiSecret string) *api.WebsocketConnectionClient { return api.NewWebsocketConnectionClient(apiKey, apiSecret) } + +func makeGraphqlEndpoint(region string) string { + region = region[4:] + return fmt.Sprintf("https://graphql.%s.runtime.vonage.cloud/v1/graphql", region) +} diff --git a/script/install.sh b/script/install.sh index b823073..beaa50d 100644 --- a/script/install.sh +++ b/script/install.sh @@ -3,6 +3,8 @@ set -e main() { + sys_exe_arg="${2:-}" + os=$(uname -s | tr '[:upper:]' '[:lower:]') arch=$(uname -m) if [ "$arch" = "x86_64" ]; then @@ -26,7 +28,7 @@ main() { bin_dir="$vcr_install/bin" tmp_dir="$vcr_install/tmp" exe="$bin_dir/vcr" - sys_exe="/usr/local/bin/vcr" + sys_exe="${sys_exe_arg:-/usr/local/bin/vcr}" mkdir -p "$bin_dir" mkdir -p "$tmp_dir" diff --git a/testutil/mocks/factory.go b/testutil/mocks/factory.go index 2714cf7..ee9190a 100644 --- a/testutil/mocks/factory.go +++ b/testutil/mocks/factory.go @@ -932,6 +932,20 @@ func (mr *MockFactoryMockRecorder) InitDeploymentClient(ctx, regionAlias interfa return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitDeploymentClient", reflect.TypeOf((*MockFactory)(nil).InitDeploymentClient), ctx, regionAlias) } +// InitUpgrade mocks base method. +func (m *MockFactory) InitUpgrade(opts *config.GlobalOptions) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "InitUpgrade", opts) + ret0, _ := ret[0].(error) + return ret0 +} + +// InitUpgrade indicates an expected call of InitUpgrade. +func (mr *MockFactoryMockRecorder) InitUpgrade(opts interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "InitUpgrade", reflect.TypeOf((*MockFactory)(nil).InitUpgrade), opts) +} + // MarketplaceClient mocks base method. func (m *MockFactory) MarketplaceClient() cmdutil.MarketplaceInterface { m.ctrl.T.Helper() diff --git a/vcr/root/root.go b/vcr/root/root.go index eb57bfd..512bf34 100644 --- a/vcr/root/root.go +++ b/vcr/root/root.go @@ -57,6 +57,12 @@ func NewCmdRoot(f cmdutil.Factory, version, buildDate, commit string, updateStre return nil } + if cmd.Name() == "upgrade" { + f.InitUpgrade(&opts) + close(updateStream) + return nil + } + cliConfig, err := config.ReadCLIConfig(opts.ConfigFilePath) if err != nil { if !errors.Is(err, config.ErrNoConfig) { @@ -67,9 +73,9 @@ func NewCmdRoot(f cmdutil.Factory, version, buildDate, commit string, updateStre cliConfig, path, err = config.ReadDefaultCLIConfig() switch { case errors.Is(err, config.ErrNoConfig): - fmt.Fprintf(io.ErrOut, "%s Config file not found at %q, please use 'vcr configure' to create one. Trying to use flags...\n", c.WarningIcon(), opts.ConfigFilePath) + fmt.Fprintf(io.Out, "%s Config file not found at %q, please use 'vcr configure' to create one. Trying to use flags...\n", c.WarningIcon(), opts.ConfigFilePath) case err == nil: - fmt.Fprintf(io.ErrOut, "%s Config file not found at %q, using %q\n", c.WarningIcon(), opts.ConfigFilePath, path) + fmt.Fprintf(io.Out, "%s Config file not found at %q, using %q\n", c.WarningIcon(), opts.ConfigFilePath, path) default: close(updateStream) return fmt.Errorf("failed to read config file %q : %w", path, err) @@ -84,11 +90,6 @@ func NewCmdRoot(f cmdutil.Factory, version, buildDate, commit string, updateStre return fmt.Errorf("failed to initialize cli: %w", err) } - if cmd.Name() == "upgrade" { - close(updateStream) - return nil - } - go func() { ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(opts.Timeout)) defer cancel() diff --git a/vcr/upgrade/upgrade.go b/vcr/upgrade/upgrade.go index c104611..f43a004 100644 --- a/vcr/upgrade/upgrade.go +++ b/vcr/upgrade/upgrade.go @@ -3,6 +3,7 @@ package upgrade import ( "bytes" "context" + "errors" "fmt" "os" "path/filepath" @@ -14,6 +15,7 @@ import ( "github.com/inconshreveable/go-update" "github.com/rhysd/go-github-selfupdate/selfupdate" "github.com/spf13/cobra" + "vonage-cloud-runtime-cli/pkg/config" "vonage-cloud-runtime-cli/pkg/api" "vonage-cloud-runtime-cli/pkg/cmdutil" @@ -23,6 +25,7 @@ type Options struct { cmdutil.Factory forceUpdate bool + path string } func NewCmdUpgrade(f cmdutil.Factory, version string) *cobra.Command { @@ -42,12 +45,25 @@ func NewCmdUpgrade(f cmdutil.Factory, version string) *cobra.Command { ctx, cancel := context.WithDeadline(context.Background(), opts.Deadline()) defer cancel() fmt.Fprint(f.IOStreams().Out, cmd.Root().Annotations["versionInfo"]) + if opts.path != "" { + absPath, err := config.GetAbsDir(opts.path) + if err != nil { + if !errors.Is(err, config.ErrNotExistedPath) { + return fmt.Errorf("failed to get absolute path of %q: %w", opts.path, err) + } + if err := os.Mkdir(absPath, 0744); err != nil { + return fmt.Errorf("failed to create directory %s: %w", absPath, err) + } + } + opts.path = absPath + } + return runUpgrade(ctx, &opts, version) }, } cmd.Flags().BoolVarP(&opts.forceUpdate, "force", "f", false, "Force update and skip prompt if new update exists") - + cmd.Flags().StringVarP(&opts.path, "directory-path", "p", "", "Path to the VCR CLI installed directory") return cmd } @@ -96,6 +112,15 @@ func runUpgrade(ctx context.Context, opts *Options, version string) error { return fmt.Errorf("failed to get executable path: %w", err) } + if opts.path != "" { + exePath = opts.path + "/vcr" + } + + if !executableExists(exePath) { + return fmt.Errorf("failed to find executable CLI file at %s", exePath) + } + + fmt.Println(exePath) spinner = cmdutil.DisplaySpinnerMessageWithHandle(fmt.Sprintf(" Updating CLI to latest version - v%s...", latestVersion)) err = updateByAsset(ctx, opts, release, exePath) spinner.Stop() @@ -179,3 +204,11 @@ func getDownloadURL(release api.Release) (string, error) { } return "", fmt.Errorf("no asset found for %s %s", runtime.GOOS, runtime.GOARCH) } + +func executableExists(path string) bool { + info, err := os.Stat(path) + if err != nil { + return false + } + return !info.IsDir() && info.Mode()&0111 != 0 +} From 42cc4e39c815ced8d7c1c01086de52f711ff7413 Mon Sep 17 00:00:00 2001 From: dacheng293 Date: Thu, 21 Nov 2024 14:45:51 -0500 Subject: [PATCH 02/13] fix: lint error Signed-off-by: dacheng293 --- pkg/cmdutil/factory.go | 5 ++--- testutil/mocks/factory.go | 6 ++---- vcr/upgrade/upgrade.go | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/pkg/cmdutil/factory.go b/pkg/cmdutil/factory.go index f4ef692..66f3b90 100644 --- a/pkg/cmdutil/factory.go +++ b/pkg/cmdutil/factory.go @@ -74,7 +74,7 @@ type DatastoreInterface interface { // Factory provides clients and parameters for all subcommands. type Factory interface { Init(ctx context.Context, cfg config.CLIConfig, opts *config.GlobalOptions) error - InitUpgrade(opts *config.GlobalOptions) error + InitUpgrade(opts *config.GlobalOptions) InitDatastore(cfg config.CLIConfig, opts *config.GlobalOptions) InitDeploymentClient(ctx context.Context, regionAlias string) error SetGlobalOptions(opts *config.GlobalOptions) @@ -147,11 +147,10 @@ func (f *DefaultFactory) Init(ctx context.Context, cfg config.CLIConfig, opts *c return nil } -func (f *DefaultFactory) InitUpgrade(opts *config.GlobalOptions) error { +func (f *DefaultFactory) InitUpgrade(opts *config.GlobalOptions) { f.globalOpts = opts f.httpClient = GetHTTPClient("", "") f.releaseClient = api.NewReleaseClient(f.releaseURL, f.httpClient) - return nil } func (f *DefaultFactory) InitDatastore(cfg config.CLIConfig, opts *config.GlobalOptions) { diff --git a/testutil/mocks/factory.go b/testutil/mocks/factory.go index ee9190a..86c81c2 100644 --- a/testutil/mocks/factory.go +++ b/testutil/mocks/factory.go @@ -933,11 +933,9 @@ func (mr *MockFactoryMockRecorder) InitDeploymentClient(ctx, regionAlias interfa } // InitUpgrade mocks base method. -func (m *MockFactory) InitUpgrade(opts *config.GlobalOptions) error { +func (m *MockFactory) InitUpgrade(opts *config.GlobalOptions) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "InitUpgrade", opts) - ret0, _ := ret[0].(error) - return ret0 + m.ctrl.Call(m, "InitUpgrade", opts) } // InitUpgrade indicates an expected call of InitUpgrade. diff --git a/vcr/upgrade/upgrade.go b/vcr/upgrade/upgrade.go index f43a004..ab3eb7e 100644 --- a/vcr/upgrade/upgrade.go +++ b/vcr/upgrade/upgrade.go @@ -15,10 +15,10 @@ import ( "github.com/inconshreveable/go-update" "github.com/rhysd/go-github-selfupdate/selfupdate" "github.com/spf13/cobra" - "vonage-cloud-runtime-cli/pkg/config" "vonage-cloud-runtime-cli/pkg/api" "vonage-cloud-runtime-cli/pkg/cmdutil" + "vonage-cloud-runtime-cli/pkg/config" ) type Options struct { From 466e3402565967b501c43724d40de01e592a40b8 Mon Sep 17 00:00:00 2001 From: dacheng293 Date: Thu, 21 Nov 2024 14:50:31 -0500 Subject: [PATCH 03/13] fix: ci Signed-off-by: dacheng293 --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd57a7d..1fd86b6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,9 +43,9 @@ jobs: run: | brew install docker docker-machine docker-compose - sudo mkdir -p /usr/local/bin - sudo curl -L -o /usr/local/bin/colima https://github.com/abiosoft/colima/releases/download/v0.6.7/colima-Darwin-x86_64 && sudo chmod +x /usr/local/bin/colima - brew install lima +# sudo mkdir -p /usr/local/bin +# sudo curl -L -o /usr/local/bin/colima https://github.com/abiosoft/colima/releases/download/v0.6.7/colima-Darwin-x86_64 && sudo chmod +x /usr/local/bin/colima +# brew install lima colima start sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock From a537722bdb416940fed55e3fb3a8664cc712f8fb Mon Sep 17 00:00:00 2001 From: dacheng293 Date: Thu, 21 Nov 2024 14:52:02 -0500 Subject: [PATCH 04/13] fix: ci Signed-off-by: dacheng293 --- .github/workflows/ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1fd86b6..5be58fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,12 +42,7 @@ jobs: - name: Set up Docker run: | brew install docker docker-machine docker-compose - -# sudo mkdir -p /usr/local/bin -# sudo curl -L -o /usr/local/bin/colima https://github.com/abiosoft/colima/releases/download/v0.6.7/colima-Darwin-x86_64 && sudo chmod +x /usr/local/bin/colima -# brew install lima colima start - sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock - name: Cache Go modules From c39d3dbdf477ff7f7ed212a19307c6769f67f0b8 Mon Sep 17 00:00:00 2001 From: dacheng293 Date: Thu, 21 Nov 2024 14:53:06 -0500 Subject: [PATCH 05/13] fix: ci Signed-off-by: dacheng293 --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5be58fd..faf6ee4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,6 +42,7 @@ jobs: - name: Set up Docker run: | brew install docker docker-machine docker-compose + brew install colima colima start sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock From 2f92dc6e5cd9e520f8f0579991c7484685eaef96 Mon Sep 17 00:00:00 2001 From: dacheng293 Date: Thu, 21 Nov 2024 14:59:40 -0500 Subject: [PATCH 06/13] fix: ci Signed-off-by: dacheng293 --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index faf6ee4..c6bb735 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,10 @@ jobs: - name: Set up Docker run: | brew install docker docker-machine docker-compose - brew install colima + sudo mkdir -p /usr/local/bin + sudo curl -L -o /usr/local/bin/colima https://github.com/abiosoft/colima/releases/download/v0.6.7/colima-Darwin-x86_64 && sudo chmod +x /usr/local/bin/colima + brew install lima + brew install qemu colima start sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock From 88f8d234136aee8bea83e0decbfcc08744ae7676 Mon Sep 17 00:00:00 2001 From: dacheng293 Date: Mon, 25 Nov 2024 10:18:55 -0500 Subject: [PATCH 07/13] test script --- script/install.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/script/install.sh b/script/install.sh index beaa50d..b07e080 100644 --- a/script/install.sh +++ b/script/install.sh @@ -3,6 +3,11 @@ set -e main() { + + + # Set the trap to catch errors and call the error_handler function + trap 'error_handler' ERR + sys_exe_arg="${2:-}" os=$(uname -s | tr '[:upper:]' '[:lower:]') @@ -58,5 +63,8 @@ main() { echo "Run '$exe --help' to get started" fi } - +error_handler() { + echo "Error occurred in script at line: ${BASH_LINENO[0]}" + exit 1 +} main "$1" \ No newline at end of file From 4d1b7c1fd6eb5f1d4a9ac5fed06802ba52ae6c44 Mon Sep 17 00:00:00 2001 From: dacheng293 Date: Mon, 25 Nov 2024 12:44:32 -0500 Subject: [PATCH 08/13] fix: correct script error --- script/install.sh | 95 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 80 insertions(+), 15 deletions(-) diff --git a/script/install.sh b/script/install.sh index b07e080..671250a 100644 --- a/script/install.sh +++ b/script/install.sh @@ -2,13 +2,55 @@ # Based on Deno installer: Copyright 2019 the Deno authors. All rights reserved. MIT license. set -e -main() { - +version="" +path="" +while test $# -gt 0; do + case "$1" in + -h|--help) + echo "options:" + echo "-h, --help show brief help" + echo "-v, --version=VERSION specify a version to download" + echo "-o, --output-dir=DIR specify a directory to install" + exit 0 + ;; + -v) + shift + if test $# -gt 0; then + version=$1 + else + echo "no version specified" + exit 1 + fi + shift + ;; + --version*) + version=`echo $1 | sed -e 's/^[^=]*=//g'` + echo "version:$version" + shift + ;; + -o) + shift + if test $# -gt 0; then + path=$1 + else + echo "no output dir specified" + exit 1 + fi + shift + ;; + --output-dir*) + path=`echo $1 | sed -e 's/^[^=]*=//g'` + echo "path:$path" + shift + ;; + *) + echo "Error: Invalid argument $1" 1>&2 + break + ;; + esac +done - # Set the trap to catch errors and call the error_handler function - trap 'error_handler' ERR - - sys_exe_arg="${2:-}" +main() { os=$(uname -s | tr '[:upper:]' '[:lower:]') arch=$(uname -m) @@ -18,7 +60,7 @@ main() { arch="arm64" fi vcr_binary="vcr_${os}_${arch}" - version="${1:+download/$1}" + version="${version:+download/$version}" version="${version:-latest/download}" vcr_uri="https://github.com/Vonage/cloud-runtime-cli/releases/$version/$vcr_binary.tar.gz" @@ -33,11 +75,17 @@ main() { bin_dir="$vcr_install/bin" tmp_dir="$vcr_install/tmp" exe="$bin_dir/vcr" - sys_exe="${sys_exe_arg:-/usr/local/bin/vcr}" + sys_exe="/usr/local/bin/vcr" mkdir -p "$bin_dir" mkdir -p "$tmp_dir" + if [ -n "$path" ]; then + echo "Path provided: $path" + mkdir -p $path + + fi + if ! curl -q --fail --location --progress-bar --output "$tmp_dir/${vcr_binary}.tar.gz" "$vcr_uri"; then echo "Error encountered when downloading ${vcr_binary} to ${tmp_dir} , please try to run with sudo" exit 1 @@ -48,9 +96,29 @@ main() { rm "$tmp_dir/${vcr_binary}.tar.gz" cp "$tmp_dir/${vcr_binary}" "$exe" + + if [ -n "$path" ]; then + if mv "$tmp_dir/${vcr_binary}" "$path/vcr"; then + echo "vcr was installed successfully to $path/vcr" + echo "Run '$path/vcr --help' to get started" + case $SHELL in + /bin/zsh) shell_profile=".zshrc" ;; + *) shell_profile=".bash_profile" ;; + esac + echo "Or manually add the directory to your \$HOME/$shell_profile (or similar)" + echo " export VCR_INSTALL=\"$path\"" + echo " export PATH=\"\$VCR_INSTALL/bin:\$PATH\"" + exit 0 + else + exit 1 + fi + + fi + if mv "$tmp_dir/${vcr_binary}" "$sys_exe"; then - echo "vcr was installed successfully to $sys_exe" - echo "Run 'vcr --help' to get started" + echo "vcr was installed successfully to $sys_exe" + echo "Run 'vcr --help' to get started" + exit 0 else case $SHELL in /bin/zsh) shell_profile=".zshrc" ;; @@ -61,10 +129,7 @@ main() { echo " export VCR_INSTALL=\"$vcr_install\"" echo " export PATH=\"\$VCR_INSTALL/bin:\$PATH\"" echo "Run '$exe --help' to get started" - fi -} -error_handler() { - echo "Error occurred in script at line: ${BASH_LINENO[0]}" exit 1 + fi } -main "$1" \ No newline at end of file +main "$1" From d4299ed6f8a8ff80bdc801cc078de6146e70d175 Mon Sep 17 00:00:00 2001 From: dacheng293 Date: Mon, 25 Nov 2024 12:48:40 -0500 Subject: [PATCH 09/13] fix: correct script error --- script/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/install.sh b/script/install.sh index 671250a..dca8dde 100644 --- a/script/install.sh +++ b/script/install.sh @@ -45,7 +45,7 @@ while test $# -gt 0; do ;; *) echo "Error: Invalid argument $1" 1>&2 - break + exit 1 ;; esac done From fc9bdcdf791a2dca35fab120e2ba26349ff40abb Mon Sep 17 00:00:00 2001 From: dacheng293 Date: Mon, 25 Nov 2024 15:12:05 -0500 Subject: [PATCH 10/13] fix: correct script error --- script/install.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/script/install.sh b/script/install.sh index dca8dde..310f6c6 100644 --- a/script/install.sh +++ b/script/install.sh @@ -120,15 +120,8 @@ main() { echo "Run 'vcr --help' to get started" exit 0 else - case $SHELL in - /bin/zsh) shell_profile=".zshrc" ;; - *) shell_profile=".bash_profile" ;; - esac echo "Error encountered when moving ${vcr_binary} to $sys_exe , please try to run with sudo" - echo "Or manually add the directory to your \$HOME/$shell_profile (or similar)" - echo " export VCR_INSTALL=\"$vcr_install\"" - echo " export PATH=\"\$VCR_INSTALL/bin:\$PATH\"" - echo "Run '$exe --help' to get started" + echo "Or use the -o flag to specify a directory where you have write permissions, for more information run with -h" exit 1 fi } From 5ba9f672014540d7d59c75adf202b967838e2415 Mon Sep 17 00:00:00 2001 From: dacheng293 Date: Mon, 25 Nov 2024 15:21:29 -0500 Subject: [PATCH 11/13] fix: correct script error --- script/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/install.sh b/script/install.sh index 310f6c6..184fce6 100644 --- a/script/install.sh +++ b/script/install.sh @@ -107,7 +107,7 @@ main() { esac echo "Or manually add the directory to your \$HOME/$shell_profile (or similar)" echo " export VCR_INSTALL=\"$path\"" - echo " export PATH=\"\$VCR_INSTALL/bin:\$PATH\"" + echo " export PATH=\"\$VCR_INSTALL:\$PATH\"" exit 0 else exit 1 From 52a8930e8a35a8f281957c7971de4ff4014fdb55 Mon Sep 17 00:00:00 2001 From: dacheng293 Date: Mon, 25 Nov 2024 16:05:46 -0500 Subject: [PATCH 12/13] fix: remove code to create new folder --- vcr/upgrade/upgrade.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/vcr/upgrade/upgrade.go b/vcr/upgrade/upgrade.go index ab3eb7e..51d9456 100644 --- a/vcr/upgrade/upgrade.go +++ b/vcr/upgrade/upgrade.go @@ -3,7 +3,6 @@ package upgrade import ( "bytes" "context" - "errors" "fmt" "os" "path/filepath" @@ -48,12 +47,7 @@ func NewCmdUpgrade(f cmdutil.Factory, version string) *cobra.Command { if opts.path != "" { absPath, err := config.GetAbsDir(opts.path) if err != nil { - if !errors.Is(err, config.ErrNotExistedPath) { - return fmt.Errorf("failed to get absolute path of %q: %w", opts.path, err) - } - if err := os.Mkdir(absPath, 0744); err != nil { - return fmt.Errorf("failed to create directory %s: %w", absPath, err) - } + return fmt.Errorf("failed to get absolute path of %q: %w", opts.path, err) } opts.path = absPath } From 7559de2fe3fa201dc509920f95458807f1e3e13c Mon Sep 17 00:00:00 2001 From: dacheng293 Date: Tue, 26 Nov 2024 09:28:06 -0500 Subject: [PATCH 13/13] fix: change flag name --- docs/vcr.md | 2 +- docs/vcr_app.md | 2 +- docs/vcr_app_create.md | 2 +- docs/vcr_app_generate-keys.md | 2 +- docs/vcr_app_list.md | 2 +- docs/vcr_configure.md | 2 +- docs/vcr_debug.md | 2 +- docs/vcr_deploy.md | 2 +- docs/vcr_init.md | 2 +- docs/vcr_instance.md | 2 +- docs/vcr_instance_log.md | 2 +- docs/vcr_instance_remove.md | 2 +- docs/vcr_mongo.md | 2 +- docs/vcr_mongo_create.md | 2 +- docs/vcr_mongo_delete.md | 2 +- docs/vcr_mongo_info.md | 2 +- docs/vcr_mongo_list.md | 2 +- docs/vcr_secret.md | 2 +- docs/vcr_secret_create.md | 2 +- docs/vcr_secret_remove.md | 2 +- docs/vcr_secret_update.md | 2 +- docs/vcr_upgrade.md | 6 +++--- vcr/upgrade/upgrade.go | 2 +- 23 files changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/vcr.md b/docs/vcr.md index 7ede048..9ccf35a 100644 --- a/docs/vcr.md +++ b/docs/vcr.md @@ -43,4 +43,4 @@ $ vcr init * [vcr secret](vcr_secret.md) - Manage VCR secrets * [vcr upgrade](vcr_upgrade.md) - Show and update VCR CLI version -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_app.md b/docs/vcr_app.md index a3911a4..72b096b 100644 --- a/docs/vcr_app.md +++ b/docs/vcr_app.md @@ -26,4 +26,4 @@ Use app commands to create, list and generate the key pairs of Vonage applicatio * [vcr app generate-keys](vcr_app_generate-keys.md) - Generate Vonage application keys * [vcr app list](vcr_app_list.md) - List Vonage applications -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_app_create.md b/docs/vcr_app_create.md index bc238cb..6aafad9 100644 --- a/docs/vcr_app_create.md +++ b/docs/vcr_app_create.md @@ -42,4 +42,4 @@ $ vcr app create --name App * [vcr app](vcr_app.md) - Use app commands to manage Vonage applications -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_app_generate-keys.md b/docs/vcr_app_generate-keys.md index bb40f52..22f9ab5 100644 --- a/docs/vcr_app_generate-keys.md +++ b/docs/vcr_app_generate-keys.md @@ -44,4 +44,4 @@ $ vcr app generate-keys --app-id 42066b10-c4ae-48a0-addd-feb2bd615a67 * [vcr app](vcr_app.md) - Use app commands to manage Vonage applications -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_app_list.md b/docs/vcr_app_list.md index 4dc1e47..060cd66 100644 --- a/docs/vcr_app_list.md +++ b/docs/vcr_app_list.md @@ -38,4 +38,4 @@ ID Name * [vcr app](vcr_app.md) - Use app commands to manage Vonage applications -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_configure.md b/docs/vcr_configure.md index 9f24963..230e6da 100644 --- a/docs/vcr_configure.md +++ b/docs/vcr_configure.md @@ -39,4 +39,4 @@ $ vcr configure * [vcr](vcr.md) - Streamline your Vonage Cloud Runtime development and management tasks with VCR -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_debug.md b/docs/vcr_debug.md index d03042f..7dc6eff 100644 --- a/docs/vcr_debug.md +++ b/docs/vcr_debug.md @@ -75,4 +75,4 @@ $ vcr debug --name debugger" * [vcr](vcr.md) - Streamline your Vonage Cloud Runtime development and management tasks with VCR -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_deploy.md b/docs/vcr_deploy.md index 35caeeb..d4de11d 100644 --- a/docs/vcr_deploy.md +++ b/docs/vcr_deploy.md @@ -85,4 +85,4 @@ $ vcr deploy * [vcr](vcr.md) - Streamline your Vonage Cloud Runtime development and management tasks with VCR -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_init.md b/docs/vcr_init.md index e2999b1..0ae840a 100644 --- a/docs/vcr_init.md +++ b/docs/vcr_init.md @@ -42,4 +42,4 @@ $ vcr init my-app * [vcr](vcr.md) - Streamline your Vonage Cloud Runtime development and management tasks with VCR -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_instance.md b/docs/vcr_instance.md index 15204fd..e054ce5 100644 --- a/docs/vcr_instance.md +++ b/docs/vcr_instance.md @@ -24,4 +24,4 @@ Used for instance management * [vcr instance log](vcr_instance_log.md) - This command will output the log of an instance. * [vcr instance remove](vcr_instance_remove.md) - This command will remove an instance. -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_instance_log.md b/docs/vcr_instance_log.md index e07ba22..d8e55e0 100644 --- a/docs/vcr_instance_log.md +++ b/docs/vcr_instance_log.md @@ -44,4 +44,4 @@ $ vcr instance log --project-name --instance-name * [vcr instance](vcr_instance.md) - Used for instance management -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_instance_remove.md b/docs/vcr_instance_remove.md index 8761cc1..19f8c0a 100644 --- a/docs/vcr_instance_remove.md +++ b/docs/vcr_instance_remove.md @@ -41,4 +41,4 @@ $ vcr instance rm --id * [vcr instance](vcr_instance.md) - Used for instance management -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_mongo.md b/docs/vcr_mongo.md index ce6b3a8..fc6b46e 100644 --- a/docs/vcr_mongo.md +++ b/docs/vcr_mongo.md @@ -22,4 +22,4 @@ Used for managing MongoDB databases * [vcr mongo info](vcr_mongo_info.md) - Get database connection info * [vcr mongo list](vcr_mongo_list.md) - List databases -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_mongo_create.md b/docs/vcr_mongo_create.md index 293507d..96c6532 100644 --- a/docs/vcr_mongo_create.md +++ b/docs/vcr_mongo_create.md @@ -34,4 +34,4 @@ $ vcr mongo create * [vcr mongo](vcr_mongo.md) - Used for managing MongoDB databases -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_mongo_delete.md b/docs/vcr_mongo_delete.md index 8bbb2a2..97c154f 100644 --- a/docs/vcr_mongo_delete.md +++ b/docs/vcr_mongo_delete.md @@ -35,4 +35,4 @@ $ vcr mongo delete --database * [vcr mongo](vcr_mongo.md) - Used for managing MongoDB databases -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_mongo_info.md b/docs/vcr_mongo_info.md index 86184f9..0d2d18b 100644 --- a/docs/vcr_mongo_info.md +++ b/docs/vcr_mongo_info.md @@ -35,4 +35,4 @@ $ vcr mongo info --database * [vcr mongo](vcr_mongo.md) - Used for managing MongoDB databases -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_mongo_list.md b/docs/vcr_mongo_list.md index b6e201d..b04f306 100644 --- a/docs/vcr_mongo_list.md +++ b/docs/vcr_mongo_list.md @@ -34,4 +34,4 @@ $ vcr mongo list * [vcr mongo](vcr_mongo.md) - Used for managing MongoDB databases -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_secret.md b/docs/vcr_secret.md index 69cecad..d272642 100644 --- a/docs/vcr_secret.md +++ b/docs/vcr_secret.md @@ -29,4 +29,4 @@ $ vcr secret create --name --file * [vcr secret remove](vcr_secret_remove.md) - Remove a secret * [vcr secret update](vcr_secret_update.md) - update a secret -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_secret_create.md b/docs/vcr_secret_create.md index fa5ae1c..cbb2aab 100644 --- a/docs/vcr_secret_create.md +++ b/docs/vcr_secret_create.md @@ -46,4 +46,4 @@ $ vcr secret create --name --file * [vcr secret](vcr_secret.md) - Manage VCR secrets -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_secret_remove.md b/docs/vcr_secret_remove.md index a629ac4..1605954 100644 --- a/docs/vcr_secret_remove.md +++ b/docs/vcr_secret_remove.md @@ -35,4 +35,4 @@ $ vcr secret remove -n * [vcr secret](vcr_secret.md) - Manage VCR secrets -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_secret_update.md b/docs/vcr_secret_update.md index 141b121..5493c9e 100644 --- a/docs/vcr_secret_update.md +++ b/docs/vcr_secret_update.md @@ -39,4 +39,4 @@ $ vcr secret update --name my-secret --value changed-value * [vcr secret](vcr_secret.md) - Manage VCR secrets -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/docs/vcr_upgrade.md b/docs/vcr_upgrade.md index 7db2a71..287afc7 100644 --- a/docs/vcr_upgrade.md +++ b/docs/vcr_upgrade.md @@ -16,8 +16,8 @@ vcr upgrade [flags] ### Options ``` - -p, --directory-path string Path to the VCR CLI installed directory - -f, --force Force update and skip prompt if new update exists + -f, --force Force update and skip prompt if new update exists + -p, --path string Path to the VCR CLI installed directory ``` ### Options inherited from parent commands @@ -36,4 +36,4 @@ vcr upgrade [flags] * [vcr](vcr.md) - Streamline your Vonage Cloud Runtime development and management tasks with VCR -###### Auto generated by spf13/cobra on 21-Nov-2024 +###### Auto generated by spf13/cobra on 26-Nov-2024 diff --git a/vcr/upgrade/upgrade.go b/vcr/upgrade/upgrade.go index 51d9456..86e3762 100644 --- a/vcr/upgrade/upgrade.go +++ b/vcr/upgrade/upgrade.go @@ -57,7 +57,7 @@ func NewCmdUpgrade(f cmdutil.Factory, version string) *cobra.Command { } cmd.Flags().BoolVarP(&opts.forceUpdate, "force", "f", false, "Force update and skip prompt if new update exists") - cmd.Flags().StringVarP(&opts.path, "directory-path", "p", "", "Path to the VCR CLI installed directory") + cmd.Flags().StringVarP(&opts.path, "path", "p", "", "Path to the VCR CLI installed directory") return cmd }