diff --git a/cmd/license.go b/cmd/license.go new file mode 100644 index 000000000..6bdb63758 --- /dev/null +++ b/cmd/license.go @@ -0,0 +1,21 @@ +package cmd + +import ( + "fmt" + + "github.com/kubeshark/kubeshark/config" + "github.com/spf13/cobra" +) + +var licenseCmd = &cobra.Command{ + Use: "license", + Short: "Print the license loaded string", + RunE: func(cmd *cobra.Command, args []string) error { + fmt.Println(config.Config.License) + return nil + }, +} + +func init() { + rootCmd.AddCommand(licenseCmd) +} diff --git a/config/config.go b/config/config.go index c4c37a9a1..69c4e439e 100644 --- a/config/config.go +++ b/config/config.go @@ -56,6 +56,7 @@ func InitConfig(cmd *cobra.Command) error { "console", "pro", "manifests", + "license", }, cmd.Use) { go version.CheckNewerVersion() } @@ -80,6 +81,7 @@ func InitConfig(cmd *cobra.Command) error { ConfigFilePath = path.Join(misc.GetDotFolderPath(), "config.yaml") if err := loadConfigFile(&Config, utils.Contains([]string{ "manifests", + "license", }, cmd.Use)); err != nil { if !os.IsNotExist(err) { return fmt.Errorf("invalid config, %w\n"+