(ctx context.Context, c *cli.Command)
| 12 | ) |
| 13 | |
| 14 | func CurrentAppCompletion(ctx context.Context, c *cli.Command) string { |
| 15 | var err error |
| 16 | |
| 17 | if len(os.Args) >= 2 { |
| 18 | for i := range os.Args { |
| 19 | if i < len(os.Args) && (os.Args[i] == "-a" || os.Args[i] == "--app") { |
| 20 | if (i+1) < len(os.Args) && os.Args[i+1] != "" { |
| 21 | return os.Args[i+1] |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | var appName string |
| 28 | if os.Getenv("SCALINGO_APP") != "" { |
| 29 | appName = os.Getenv("SCALINGO_APP") |
| 30 | } |
| 31 | if dir, ok := utils.DetectGit(); appName == "" && ok { |
| 32 | appName, err = detect.GetAppNameFromGitRemote(ctx, dir, detect.RemoteNameFromFlags(c)) |
| 33 | if err != nil { |
| 34 | debug.Println(err) |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | return appName |
| 39 | } |
no test coverage detected