func fullCfgPath(filename string) (string, error) { cfgHome, err := util.ConfigHome() if err != nil { return "", errors.Trace(err) } return filepath.Join(cfgHome, filename), nil }
`[1:], Flags: []cli.Flag{ cli.StringFlag{ Name: "editor", Value: "vi", Usage: "editor to open the config file with", }, }, Action: editConfigAction, BashComplete: func(c *cli.Context) { // This will complete if no args are passed if len(c.Args()) > 0 { return } cfgDir, err := util.ConfigHome() if err != nil { log.Printf("auto complete error %v", err) return } files, err := filepath.Glob(cfgDir + "/*") if err != nil { log.Printf("auto complete error %v", err) return } cfgs := make([]string, len(files)) for i, f := range files { f = strings.TrimPrefix(f, cfgDir+"/") f = strings.TrimSuffix(f, ".yaml")