Skip to content

Commit

Permalink
Add info command
Browse files Browse the repository at this point in the history
  • Loading branch information
moshe-kabala committed Nov 25, 2024
1 parent 9a4438d commit 1fa3f76
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
38 changes: 38 additions & 0 deletions cmd/server/info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package server

import (
"github.com/spf13/cobra"
"github.com/tensorleap/helm-charts/pkg/server"
"github.com/tensorleap/leap-cli/pkg/log"
"gopkg.in/yaml.v3"
)

func NewInfoCmd() *cobra.Command {

cmd := &cobra.Command{
Use: "info",
Short: "Server installation information",
Long: "Server installation information",
RunE: func(cmd *cobra.Command, args []string) error {
installationParams, err := server.LoadInstallationParamsFromPrevious()
if err == server.ErrNoInstallationParams {
log.Info("No installation information found")
return nil
}
if err != nil {
return err
}

log.Info("Installation information:")
installationParamsYaml, err := yaml.Marshal(installationParams)
if err != nil {
return err
}
log.Info(string(installationParamsYaml))
return nil
},
}

return cmd
}

1 change: 1 addition & 0 deletions cmd/server/root_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ func init() {
RootCommand.AddCommand(NewUpgradeCmd())
RootCommand.AddCommand(NewReinstallCmd())
RootCommand.AddCommand(NewUninstallCmd())
RootCommand.AddCommand(NewInfoCmd())
RootCommand.AddCommand(server.NewRunCmd())
RootCommand.AddCommand(server.NewStopCmd())
RootCommand.AddCommand(server.NewToolCmd())
Expand Down

0 comments on commit 1fa3f76

Please sign in to comment.