|
1 | 1 | package cmds
|
2 | 2 |
|
3 | 3 | import (
|
| 4 | + "errors" |
4 | 5 | "fmt"
|
5 | 6 | "io"
|
6 | 7 | "os"
|
@@ -94,14 +95,14 @@ func CmdAlias(f cmdutil.Factory) *cobra.Command {
|
94 | 95 | if err != nil {
|
95 | 96 | return err
|
96 | 97 | }
|
97 |
| - for _, config := range configs { |
98 |
| - c := exec.Command(name, config.Flags...) |
| 98 | + for _, conf := range configs { |
| 99 | + c := exec.Command(name, conf.Flags...) |
99 | 100 | c.Stdout = os.Stdout
|
100 | 101 | c.Stdin = os.Stdin
|
101 | 102 | c.Stderr = os.Stderr
|
102 |
| - fmt.Printf("Alias: %s\n", config.Name) |
103 |
| - if config.Description != "" { |
104 |
| - fmt.Printf("Description: %s\n", config.Description) |
| 103 | + fmt.Printf("Name: %s\n", conf.Name) |
| 104 | + if conf.Description != "" { |
| 105 | + fmt.Printf("Description: %s\n", conf.Description) |
105 | 106 | }
|
106 | 107 | fmt.Printf("Command: %v\n", c.Args)
|
107 | 108 | err = c.Run()
|
@@ -149,7 +150,7 @@ func ParseAndGet(localFile, remoteAddr string, aliasName string) ([]Config, erro
|
149 | 150 | names = append(names, c.Name)
|
150 | 151 | }
|
151 | 152 | }
|
152 |
| - err = fmt.Errorf("failed to find any aliases for the name: '%s', avaliable: [%s], please verify your configuration file %s", aliasName, strings.Join(names, ", "), path) |
| 153 | + err = errors.New(fmt.Sprintf("Can't find any alias for the name: '%s', avaliable: \n[\"%s\"]\nPlease check config file: %s", aliasName, strings.Join(names, "\", \""), path)) |
153 | 154 | return nil, err
|
154 | 155 | }
|
155 | 156 | return configs, nil
|
|
0 commit comments