mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-24 11:37:26 +00:00
✨ Add license
command
This commit is contained in:
21
cmd/license.go
Normal file
21
cmd/license.go
Normal file
@@ -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)
|
||||||
|
}
|
@@ -56,6 +56,7 @@ func InitConfig(cmd *cobra.Command) error {
|
|||||||
"console",
|
"console",
|
||||||
"pro",
|
"pro",
|
||||||
"manifests",
|
"manifests",
|
||||||
|
"license",
|
||||||
}, cmd.Use) {
|
}, cmd.Use) {
|
||||||
go version.CheckNewerVersion()
|
go version.CheckNewerVersion()
|
||||||
}
|
}
|
||||||
@@ -80,6 +81,7 @@ func InitConfig(cmd *cobra.Command) error {
|
|||||||
ConfigFilePath = path.Join(misc.GetDotFolderPath(), "config.yaml")
|
ConfigFilePath = path.Join(misc.GetDotFolderPath(), "config.yaml")
|
||||||
if err := loadConfigFile(&Config, utils.Contains([]string{
|
if err := loadConfigFile(&Config, utils.Contains([]string{
|
||||||
"manifests",
|
"manifests",
|
||||||
|
"license",
|
||||||
}, cmd.Use)); err != nil {
|
}, cmd.Use)); err != nil {
|
||||||
if !os.IsNotExist(err) {
|
if !os.IsNotExist(err) {
|
||||||
return fmt.Errorf("invalid config, %w\n"+
|
return fmt.Errorf("invalid config, %w\n"+
|
||||||
|
Reference in New Issue
Block a user