func DbTunnelAutoComplete(c *cli.Context) error { appName := CurrentAppCompletion(c) if appName == "" { return nil } lastArg := "" if len(os.Args) > 2 { lastArg = os.Args[len(os.Args)-2] } if !strings.HasPrefix(lastArg, "-") { variables, err := api.VariablesList(appName) if err == nil { for _, v := range variables { if matched, err := regexp.Match("SCALINGO_.*_URL", []byte(v.Name)); matched && err == nil { fmt.Println(v.Name) } } } } return nil }
func Delete(app string, varNames []string) error { vars, err := api.VariablesList(app) if err != nil { return errgo.Mask(err, errgo.Any) } var varsToUnset api.Variables for _, varName := range varNames { v, ok := vars.Contains(varName) if !ok { return errgo.Newf("%s variable does not exist", varName) } varsToUnset = append(varsToUnset, v) } for _, v := range varsToUnset { err := api.VariableUnset(app, v.ID) if err != nil { return errgo.Mask(err, errgo.Any) } fmt.Printf("%s has been unset.\n", v.Name) } return nil }
func Display(app string) error { vars, err := api.VariablesList(app) if err != nil { return errgo.Mask(err, errgo.Any) } for _, v := range vars { fmt.Printf("%s=%s\n", v.Name, v.Value) } return nil }
func EnvUnsetAutoComplete(c *cli.Context) error { appName := CurrentAppCompletion(c) if appName == "" { return nil } variables, err := api.VariablesList(appName) if err == nil { for _, v := range variables { fmt.Println(v.Name) } } return nil }