Skip to content

Commit

Permalink
feat: alias add description (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
wencaiwulue authored Nov 22, 2024
1 parent 5a0533c commit 9edf012
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions cmd/kubevpn/cmds/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
// CmdAlias
/**
Name: test
Description: this is a test environment
Needs: test1
Flags:
- connect
Expand All @@ -30,6 +31,7 @@ Flags:
---
Name: test1
Description: this is another test environment
Flags:
- connect
- --kubeconfig=~/.kube/jumper_config
Expand Down Expand Up @@ -97,7 +99,11 @@ func CmdAlias(f cmdutil.Factory) *cobra.Command {
c.Stdout = os.Stdout
c.Stdin = os.Stdin
c.Stderr = os.Stderr
fmt.Println(c.Args)
fmt.Printf("Alias: %s\n", config.Name)
if config.Description != "" {
fmt.Printf("Description: %s\n", config.Description)
}
fmt.Printf("Command: %v\n", c.Args)
err = c.Run()
if err != nil {
return err
Expand Down Expand Up @@ -190,7 +196,8 @@ func GetConfigs(configs []Config, name string) ([]Config, error) {
}

type Config struct {
Name string `yaml:"Name"`
Needs string `yaml:"Needs,omitempty"`
Flags []string `yaml:"Flags,omitempty"`
Name string `yaml:"Name"`
Description string `yaml:"Description"`
Needs string `yaml:"Needs,omitempty"`
Flags []string `yaml:"Flags,omitempty"`
}

0 comments on commit 9edf012

Please sign in to comment.