From e63a10bf6ced7b5834c9106d6bba6a37142ad101 Mon Sep 17 00:00:00 2001 From: "jan.hajek@zerops.io" Date: Sat, 9 Mar 2024 23:36:33 +0100 Subject: [PATCH] fix linter --- src/cmd/projectStart.go | 54 ---------------------------------------- src/cmd/projectStop.go | 55 ----------------------------------------- src/cmd/root.go | 2 +- 3 files changed, 1 insertion(+), 110 deletions(-) delete mode 100644 src/cmd/projectStart.go delete mode 100644 src/cmd/projectStop.go diff --git a/src/cmd/projectStart.go b/src/cmd/projectStart.go deleted file mode 100644 index 4967b509..00000000 --- a/src/cmd/projectStart.go +++ /dev/null @@ -1,54 +0,0 @@ -package cmd - -import ( - "context" - - "github.com/zeropsio/zcli/src/cmd/scope" - "github.com/zeropsio/zcli/src/cmdBuilder" - "github.com/zeropsio/zcli/src/i18n" - "github.com/zeropsio/zcli/src/uxHelpers" - "github.com/zeropsio/zerops-go/dto/input/path" -) - -func projectStartCmd() *cmdBuilder.Cmd { - return cmdBuilder.NewCmd(). - Use("start"). - Short(i18n.T(i18n.CmdProjectStart)). - ScopeLevel(scope.Project). - Arg(scope.ProjectArgName, cmdBuilder.OptionalArg()). - HelpFlag(i18n.T(i18n.ProjectStartHelp)). - LoggedUserRunFunc(func(ctx context.Context, cmdData *cmdBuilder.LoggedUserCmdData) error { - startProjectResponse, err := cmdData.RestApiClient.PutProjectStart( - ctx, - path.ProjectId{ - Id: cmdData.Project.ID, - }, - ) - if err != nil { - return err - } - - responseOutput, err := startProjectResponse.Output() - if err != nil { - return err - } - - processId := responseOutput.Id - - err = uxHelpers.ProcessCheckWithSpinner( - ctx, - cmdData.UxBlocks, - []uxHelpers.Process{{ - F: uxHelpers.CheckZeropsProcess(processId, cmdData.RestApiClient), - RunningMessage: i18n.T(i18n.ProjectStarting), - ErrorMessageMessage: i18n.T(i18n.ProjectStarting), - SuccessMessage: i18n.T(i18n.ProjectStarted), - }}, - ) - if err != nil { - return err - } - - return nil - }) -} diff --git a/src/cmd/projectStop.go b/src/cmd/projectStop.go deleted file mode 100644 index 83e5b364..00000000 --- a/src/cmd/projectStop.go +++ /dev/null @@ -1,55 +0,0 @@ -package cmd - -import ( - "context" - - "github.com/zeropsio/zcli/src/cmd/scope" - "github.com/zeropsio/zcli/src/cmdBuilder" - "github.com/zeropsio/zcli/src/uxHelpers" - "github.com/zeropsio/zerops-go/dto/input/path" - - "github.com/zeropsio/zcli/src/i18n" -) - -func projectStopCmd() *cmdBuilder.Cmd { - return cmdBuilder.NewCmd(). - Use("stop"). - Short(i18n.T(i18n.CmdProjectStop)). - ScopeLevel(scope.Project). - Arg(scope.ProjectArgName, cmdBuilder.OptionalArg()). - HelpFlag(i18n.T(i18n.ProjectStopHelp)). - LoggedUserRunFunc(func(ctx context.Context, cmdData *cmdBuilder.LoggedUserCmdData) error { - stopProjectResponse, err := cmdData.RestApiClient.PutProjectStop( - ctx, - path.ProjectId{ - Id: cmdData.Project.ID, - }, - ) - if err != nil { - return err - } - - responseOutput, err := stopProjectResponse.Output() - if err != nil { - return err - } - - processId := responseOutput.Id - - err = uxHelpers.ProcessCheckWithSpinner( - ctx, - cmdData.UxBlocks, - []uxHelpers.Process{{ - F: uxHelpers.CheckZeropsProcess(processId, cmdData.RestApiClient), - RunningMessage: i18n.T(i18n.ProjectStopping), - ErrorMessageMessage: i18n.T(i18n.ProjectStopping), - SuccessMessage: i18n.T(i18n.ProjectStopped), - }}, - ) - if err != nil { - return err - } - - return nil - }) -} diff --git a/src/cmd/root.go b/src/cmd/root.go index 63c28b9c..db1a9594 100644 --- a/src/cmd/root.go +++ b/src/cmd/root.go @@ -43,7 +43,7 @@ func rootCmd() *cmdBuilder.Cmd { LoggedUserRunFunc(func(ctx context.Context, cmdData *cmdBuilder.LoggedUserCmdData) error { body := &uxBlock.TableBody{} - loggedUser := "" + var loggedUser string if info, err := cmdData.RestApiClient.GetUserInfo(ctx); err != nil { loggedUser = err.Error() } else {