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

Function extractAppName

detect/app.go:232–252  ·  view source on GitHub ↗
(ctx context.Context, c *cli.Command)

Source from the content-addressed store, hash-verified

230}
231
232func extractAppName(ctx context.Context, c *cli.Command) string {
233 for _, cliContext := range c.Lineage() {
234 appName := cliContext.String("app")
235 if appName != "" && appName != "<name>" {
236 return appName
237 }
238 }
239
240 var err error
241 var appName string
242
243 if os.Getenv("SCALINGO_APP") != "" {
244 appName = os.Getenv("SCALINGO_APP")
245 } else if dir, ok := utils.DetectGit(); ok {
246 appName, err = GetAppNameFromGitRemote(ctx, dir, RemoteNameFromFlags(c))
247 if err != nil {
248 debug.Println(err)
249 }
250 }
251 return appName
252}
253
254func ExtractDatabaseNameFromCommandLineOrEnv(c *cli.Command) string {
255 if os.Getenv("SCALINGO_PREVIEW_FEATURES") != "true" {

Callers 2

CurrentAppFunction · 0.85

Calls 3

DetectGitFunction · 0.92
GetAppNameFromGitRemoteFunction · 0.85
RemoteNameFromFlagsFunction · 0.85

Tested by

no test coverage detected