Skip to content

Commit 32d2f8e

Browse files
committed
chore: should also have a check when user has a plan
1 parent 37ed420 commit 32d2f8e

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

cmd/squarecloud/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func newSquareCloudCommand(squareCli cli.SquareCLI) *cobra.Command {
3737
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
3838
if cmd.Parent() != nil {
3939
if cmd.Parent().Name() != "completion" && cli.ShouldCheckAuth(squareCli, cmd) && !cli.CheckAuth(squareCli) {
40-
fmt.Fprintf(squareCli.Out(), "%s You must be logged to execute this command, try to execute: squarecloud auth login\n", ui.XMark)
40+
fmt.Fprintf(squareCli.Out(), "%s %s\n", ui.XMark, squareCli.I18n().T("errors.common.not_logged"))
4141
return &cli.AuthError{}
4242
}
4343
}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import (
77
"github.com/spf13/pflag"
88
)
99

10+
func CheckAuth(squareCli SquareCLI) bool {
11+
return squareCli.Config().AuthToken != ""
12+
}
13+
1014
// thank you https://github.com/cli/cli/blob/trunk/pkg/cmdutil/auth_check.go#L41
1115
func ShouldCheckAuth(squareCli SquareCLI, cmd *cobra.Command) bool {
1216
switch cmd.Name() {
@@ -31,7 +35,3 @@ func ShouldCheckAuth(squareCli SquareCLI, cmd *cobra.Command) bool {
3135
}
3236
return true
3337
}
34-
35-
func CheckAuth(squareCli SquareCLI) bool {
36-
return squareCli.Config().AuthToken != ""
37-
}

internal/cli/cli.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import (
55
"io"
66
"os"
77

8+
"github.com/squarecloudofc/cli/i18n"
89
"github.com/squarecloudofc/cli/internal/build"
910
"github.com/squarecloudofc/cli/internal/config"
10-
"github.com/squarecloudofc/cli/internal/i18n"
1111
"github.com/squarecloudofc/sdk-api-go/rest"
1212
)
1313

internal/command/auth/login.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
func NewLoginCommand(squareCli cli.SquareCLI) *cobra.Command {
1313
cmd := &cobra.Command{
1414
Use: "login",
15-
Short: "Login to Square Cloud",
15+
Short: squareCli.I18n().T("commands.auth.login.metadata.short"),
1616
Annotations: map[string]string{"skipAuthCheck": "true"},
1717
RunE: runLoginCommand(squareCli),
1818
}

0 commit comments

Comments
 (0)