MCPcopy Create free account
hub / github.com/Scalingo/cli / CurrentAppCompletion

Function CurrentAppCompletion

cmd/autocomplete/current_app.go:14–39  ·  view source on GitHub ↗
(ctx context.Context, c *cli.Command)

Source from the content-addressed store, hash-verified

12)
13
14func 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}

Callers 12

RestartAutoCompleteFunction · 0.85
ScaleAutoCompleteFunction · 0.85
DbTunnelAutoCompleteFunction · 0.85
NotifiersAutoCompleteFunction · 0.85
EnvUnsetAutoCompleteFunction · 0.85
AddonsPlansAutoCompleteFunction · 0.85
AddonsRemoveAutoCompleteFunction · 0.85

Calls 3

DetectGitFunction · 0.92
GetAppNameFromGitRemoteFunction · 0.92
RemoteNameFromFlagsFunction · 0.92

Tested by

no test coverage detected