Skip to content

Commit b7431d9

Browse files
feat: upgrade salt library from v0.3.8 to v0.6.2
Breaking changes in salt v0.6.2 required the following migrations: - config: Use new Option type, removed WithName/WithPath/WithEnvKeyReplacer - cmdx -> cli/commander: Use new Manager pattern for CLI setup - cmdx.SetConfig -> config.WithAppConfig: New config management API - version -> cli/releaser: UpdateNotice renamed to CheckForUpdate - mux -> server/mux: Package path changed - spa -> server/spa: Package path changed - printer -> cli/printer: Package path changed Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 37b428e commit b7431d9

File tree

17 files changed

+105
-314
lines changed

17 files changed

+105
-314
lines changed

cmd/config.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55

66
"github.com/MakeNowJust/heredoc"
7-
"github.com/raystack/salt/cmdx"
7+
"github.com/raystack/salt/config"
88
"github.com/spf13/cobra"
99
)
1010

@@ -13,12 +13,12 @@ type Config struct {
1313
}
1414

1515
func LoadConfig() (*Config, error) {
16-
var config Config
16+
var cfg Config
1717

18-
cfg := cmdx.SetConfig("frontier")
19-
err := cfg.Load(&config)
18+
loader := config.NewLoader(config.WithAppConfig("frontier"))
19+
err := loader.Load(&cfg)
2020

21-
return &config, err
21+
return &cfg, err
2222
}
2323

2424
func configCommand() *cobra.Command {
@@ -47,13 +47,13 @@ func configInitCommand() *cobra.Command {
4747
"group": "core",
4848
},
4949
RunE: func(cmd *cobra.Command, args []string) error {
50-
cfg := cmdx.SetConfig("frontier")
50+
loader := config.NewLoader(config.WithAppConfig("frontier"))
5151

52-
if err := cfg.Init(&Config{}); err != nil {
52+
if err := loader.Init(&Config{}); err != nil {
5353
return err
5454
}
5555

56-
fmt.Printf("config created: %v\n", cfg.File())
56+
fmt.Println("config created")
5757
return nil
5858
},
5959
}
@@ -70,9 +70,9 @@ func configListCommand() *cobra.Command {
7070
"group": "core",
7171
},
7272
RunE: func(cmd *cobra.Command, args []string) error {
73-
cfg := cmdx.SetConfig("frontier")
73+
loader := config.NewLoader(config.WithAppConfig("frontier"))
7474

75-
data, err := cfg.Read()
75+
data, err := loader.View()
7676
if err != nil {
7777
return ErrClientConfigNotFound
7878
}

cmd/group.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/MakeNowJust/heredoc"
88
"github.com/raystack/frontier/pkg/file"
99
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
10-
"github.com/raystack/salt/printer"
10+
"github.com/raystack/salt/cli/printer"
1111
cli "github.com/spf13/cobra"
1212
)
1313

cmd/namespace.go

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

77
"github.com/MakeNowJust/heredoc"
88
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
9-
"github.com/raystack/salt/printer"
9+
"github.com/raystack/salt/cli/printer"
1010
cli "github.com/spf13/cobra"
1111
)
1212

cmd/organization.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/MakeNowJust/heredoc"
88
"github.com/raystack/frontier/pkg/file"
99
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
10-
"github.com/raystack/salt/printer"
10+
"github.com/raystack/salt/cli/printer"
1111
cli "github.com/spf13/cobra"
1212
)
1313

cmd/permission.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/MakeNowJust/heredoc"
88
"github.com/raystack/frontier/pkg/file"
99
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
10-
"github.com/raystack/salt/printer"
10+
"github.com/raystack/salt/cli/printer"
1111
cli "github.com/spf13/cobra"
1212
)
1313

cmd/policy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/MakeNowJust/heredoc"
88
"github.com/raystack/frontier/pkg/file"
99
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
10-
"github.com/raystack/salt/printer"
10+
"github.com/raystack/salt/cli/printer"
1111
cli "github.com/spf13/cobra"
1212
)
1313

cmd/preferences.go

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

88
"github.com/MakeNowJust/heredoc"
99
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
10-
"github.com/raystack/salt/printer"
10+
"github.com/raystack/salt/cli/printer"
1111
"github.com/spf13/cobra"
1212
cli "github.com/spf13/cobra"
1313
)

cmd/project.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/MakeNowJust/heredoc"
88
"github.com/raystack/frontier/pkg/file"
99
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
10-
"github.com/raystack/salt/printer"
10+
"github.com/raystack/salt/cli/printer"
1111
cli "github.com/spf13/cobra"
1212
)
1313

cmd/role.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/MakeNowJust/heredoc"
99
"github.com/raystack/frontier/pkg/file"
1010
frontierv1beta1 "github.com/raystack/frontier/proto/v1beta1"
11-
"github.com/raystack/salt/printer"
11+
"github.com/raystack/salt/cli/printer"
1212
cli "github.com/spf13/cobra"
1313
)
1414

cmd/root.go

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

33
import (
44
"github.com/MakeNowJust/heredoc"
5-
"github.com/raystack/salt/cmdx"
5+
"github.com/raystack/salt/cli/commander"
66
"github.com/spf13/cobra"
77
cli "github.com/spf13/cobra"
88
)
@@ -54,10 +54,12 @@ func New(cliConfig *Config) *cli.Command {
5454
cmd.AddCommand(PreferencesCommand(cliConfig))
5555

5656
// Help topics
57-
cmdx.SetHelp(cmd)
58-
cmd.AddCommand(cmdx.SetCompletionCmd("frontier"))
59-
cmd.AddCommand(cmdx.SetHelpTopicCmd("environment", envHelp))
60-
cmd.AddCommand(cmdx.SetHelpTopicCmd("auth", authHelp))
61-
cmd.AddCommand(cmdx.SetRefCmd(cmd))
57+
manager := commander.New(cmd,
58+
commander.WithTopics([]commander.HelpTopic{
59+
{Name: "environment", Short: envHelp["short"], Long: envHelp["long"]},
60+
{Name: "auth", Short: authHelp["short"], Long: authHelp["long"]},
61+
}),
62+
)
63+
manager.Init()
6264
return cmd
6365
}

0 commit comments

Comments
 (0)