Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: alias add description #376

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"`
}
Loading