Skip to content

Commit 24461c0

Browse files
committed
chore: upgrade salt package
1 parent eb799d0 commit 24461c0

File tree

18 files changed

+320
-1844
lines changed

18 files changed

+320
-1844
lines changed

cmd/check.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import (
77
"os"
88

99
"github.com/MakeNowJust/heredoc"
10-
"github.com/raystack/salt/printer"
11-
"github.com/raystack/salt/term"
10+
"github.com/raystack/salt/cli/printer"
1211
stencilv1beta1 "github.com/raystack/stencil/proto/raystack/stencil/v1beta1"
1312
"github.com/spf13/cobra"
1413
"google.golang.org/grpc/status"
@@ -57,7 +56,7 @@ func checkSchemaCmd(cdk *CDK) *cobra.Command {
5756
}
5857

5958
spinner.Stop()
60-
fmt.Printf("\n%s Schema is compatible.\n", term.Green(term.SuccessIcon()))
59+
fmt.Printf("\n%s Schema is compatible.\n", printer.Green(printer.Icon("success")))
6160
return nil
6261
},
6362
}

cmd/client.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@ package cmd
22

33
import (
44
"context"
5-
"errors"
65
"time"
76

8-
"github.com/raystack/salt/cmdx"
97
"github.com/raystack/salt/config"
108
stencilv1beta1 "github.com/raystack/stencil/proto/raystack/stencil/v1beta1"
119
"github.com/spf13/cobra"
@@ -54,16 +52,14 @@ func createClient(cmd *cobra.Command, cdk *CDK) (stencilv1beta1.StencilServiceCl
5452
return client, cancel, nil
5553
}
5654

57-
func loadClientConfig(cmd *cobra.Command, cmdxConfig *cmdx.Config) (*ClientConfig, error) {
55+
func loadClientConfig(cmd *cobra.Command, cmdxConfig *config.Loader) (*ClientConfig, error) {
5856
var clientConfig ClientConfig
5957

6058
if err := cmdxConfig.Load(
6159
&clientConfig,
62-
cmdx.WithFlags(cmd.Flags()),
6360
); err != nil {
64-
if !errors.Is(err, new(config.ConfigFileNotFoundError)) {
65-
return nil, ErrClientConfigNotFound
66-
}
61+
return nil, err
62+
6763
}
6864

6965
return &clientConfig, nil

cmd/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func configInitCommand(cdk *CDK) *cobra.Command {
3232
return err
3333
}
3434

35-
fmt.Printf("Config created: %v\n", cdk.Config.File())
35+
fmt.Printf("Config created\n")
3636
return nil
3737
},
3838
}
@@ -49,7 +49,7 @@ func configListCommand(cdk *CDK) *cobra.Command {
4949
"group": "core",
5050
},
5151
RunE: func(cmd *cobra.Command, args []string) error {
52-
data, err := cdk.Config.Read()
52+
data, err := cdk.Config.View()
5353
if err != nil {
5454
return ErrClientConfigNotFound
5555
}

cmd/create.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import (
77
"os"
88

99
"github.com/MakeNowJust/heredoc"
10-
"github.com/raystack/salt/printer"
11-
"github.com/raystack/salt/term"
10+
"github.com/raystack/salt/cli/printer"
1211
stencilv1beta1 "github.com/raystack/stencil/proto/raystack/stencil/v1beta1"
1312
"github.com/spf13/cobra"
1413
"google.golang.org/grpc/codes"
@@ -52,7 +51,7 @@ func createSchemaCmd(cdk *CDK) *cobra.Command {
5251
if err != nil {
5352
errStatus := status.Convert(err)
5453
if codes.AlreadyExists == errStatus.Code() {
55-
fmt.Printf("\n%s Schema with id '%s' already exist.\n", term.FailureIcon(), args[0])
54+
fmt.Printf("\n%s Schema with id '%s' already exist.\n", printer.Icon("failure"), args[0])
5655
return nil
5756
}
5857
return errors.New(errStatus.Message())
@@ -61,7 +60,7 @@ func createSchemaCmd(cdk *CDK) *cobra.Command {
6160
id := res.GetId()
6261

6362
spinner.Stop()
64-
fmt.Printf("\n%s Created schema with id %s.\n", term.Green(term.SuccessIcon()), term.Cyan(id))
63+
fmt.Printf("\n%s Created schema with id %s.\n", printer.Green(printer.Icon("success")), printer.Cyan(id))
6564
return nil
6665
},
6766
}

cmd/delete.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66

77
"github.com/MakeNowJust/heredoc"
8-
"github.com/raystack/salt/printer"
8+
"github.com/raystack/salt/cli/printer"
99
stencilv1beta1 "github.com/raystack/stencil/proto/raystack/stencil/v1beta1"
1010
"github.com/spf13/cobra"
1111
)

cmd/diff.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"fmt"
77

88
"github.com/MakeNowJust/heredoc"
9-
"github.com/raystack/salt/printer"
9+
"github.com/raystack/salt/cli/printer"
1010
stencilv1beta1 "github.com/raystack/stencil/proto/raystack/stencil/v1beta1"
1111
"github.com/spf13/cobra"
1212
"github.com/yudai/gojsondiff"

cmd/download.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import (
55
"os"
66

77
"github.com/MakeNowJust/heredoc"
8-
"github.com/raystack/salt/printer"
9-
"github.com/raystack/salt/term"
8+
"github.com/raystack/salt/cli/printer"
109
"github.com/spf13/cobra"
1110
)
1211

@@ -42,7 +41,7 @@ func downloadSchemaCmd(cdk *CDK) *cobra.Command {
4241
return err
4342
}
4443

45-
fmt.Printf("%s Schema successfully written to %s\n", term.Green(term.SuccessIcon()), output)
44+
fmt.Printf("%s Schema successfully written to %s\n", printer.Green(printer.Icon("success")), output)
4645
return nil
4746
},
4847
}

cmd/edit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"fmt"
66

77
"github.com/MakeNowJust/heredoc"
8-
"github.com/raystack/salt/printer"
8+
"github.com/raystack/salt/cli/printer"
99
stencilv1beta1 "github.com/raystack/stencil/proto/raystack/stencil/v1beta1"
1010
"github.com/spf13/cobra"
1111
)

cmd/info.go

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import (
77
"strconv"
88

99
"github.com/MakeNowJust/heredoc"
10-
"github.com/raystack/salt/printer"
11-
"github.com/raystack/salt/term"
10+
"github.com/raystack/salt/cli/printer"
1211
stencilv1beta1 "github.com/raystack/stencil/proto/raystack/stencil/v1beta1"
1312
"github.com/spf13/cobra"
1413
"google.golang.org/grpc/codes"
@@ -44,18 +43,18 @@ func infoSchemaCmd(cdk *CDK) *cobra.Command {
4443
if err != nil {
4544
errStatus, _ := status.FromError(err)
4645
if codes.NotFound == errStatus.Code() {
47-
fmt.Printf("%s Schema with id '%s' not found.\n", term.Red(term.FailureIcon()), args[0])
46+
fmt.Printf("%s Schema with id '%s' not found.\n", printer.Red(printer.Icon("failure")), args[0])
4847
return nil
4948
}
5049
return err
5150
}
5251

53-
fmt.Printf("\n%s\n", term.Blue(args[0]))
54-
fmt.Printf("\n%s\n\n", term.Grey("No description provided"))
55-
fmt.Printf("%s \t %s \n", term.Grey("Namespace:"), namespace)
56-
fmt.Printf("%s \t %s \n", term.Grey("Format:"), dict[info.GetFormat().String()])
57-
fmt.Printf("%s \t %s \n", term.Grey("Compatibility:"), dict[info.GetCompatibility().String()])
58-
fmt.Printf("%s \t %s \n\n", term.Grey("Authority:"), dict[info.GetAuthority()])
52+
fmt.Printf("\n%s\n", printer.Blue(args[0]))
53+
fmt.Printf("\n%s\n\n", printer.Grey("No description provided"))
54+
fmt.Printf("%s \t %s \n", printer.Grey("Namespace:"), namespace)
55+
fmt.Printf("%s \t %s \n", printer.Grey("Format:"), dict[info.GetFormat().String()])
56+
fmt.Printf("%s \t %s \n", printer.Grey("Compatibility:"), dict[info.GetCompatibility().String()])
57+
fmt.Printf("%s \t %s \n\n", printer.Grey("Authority:"), dict[info.GetAuthority()])
5958
return nil
6059
},
6160
}
@@ -109,7 +108,7 @@ func versionSchemaCmd(cdk *CDK) *cobra.Command {
109108

110109
for _, v := range versions {
111110
report = append(report, []string{
112-
term.Greenf("#%v", strconv.FormatInt(int64(v), 10)),
111+
printer.Greenf("#%v", strconv.FormatInt(int64(v), 10)),
113112
"-",
114113
"-",
115114
})

cmd/list.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import (
66
"os"
77

88
"github.com/MakeNowJust/heredoc"
9-
"github.com/raystack/salt/printer"
10-
"github.com/raystack/salt/term"
9+
"github.com/raystack/salt/cli/printer"
1110
stencilv1beta1 "github.com/raystack/stencil/proto/raystack/stencil/v1beta1"
1211
"github.com/spf13/cobra"
1312
)
@@ -53,11 +52,11 @@ func listSchemaCmd(cdk *CDK) *cobra.Command {
5352
report := [][]string{}
5453
index := 1
5554
report = append(report, []string{
56-
term.Bold("INDEX"),
57-
term.Bold("NAME"),
58-
term.Bold("FORMAT"),
59-
term.Bold("COMPATIBILITY"),
60-
term.Bold("AUTHORITY"),
55+
printer.Bold("INDEX"),
56+
printer.Bold("NAME"),
57+
printer.Bold("FORMAT"),
58+
printer.Bold("COMPATIBILITY"),
59+
printer.Bold("AUTHORITY"),
6160
})
6261
for _, s := range schemas {
6362
c := s.GetCompatibility().String()
@@ -67,7 +66,7 @@ func listSchemaCmd(cdk *CDK) *cobra.Command {
6766
if a == "" {
6867
a = "-"
6968
}
70-
report = append(report, []string{term.Greenf("#%d", index), s.GetName(), dict[f], dict[c], a})
69+
report = append(report, []string{printer.Greenf("#%d", index), s.GetName(), dict[f], dict[c], a})
7170
index++
7271
}
7372

0 commit comments

Comments
 (0)