GetCurrentDatabase is a helper to get the current database name and UUID.
(ctx context.Context, c *cli.Command)
| 73 | |
| 74 | // GetCurrentDatabase is a helper to get the current database name and UUID. |
| 75 | func GetCurrentDatabase(ctx context.Context, c *cli.Command) (string, string) { |
| 76 | currentDatabase, databaseUUID, err := currentDatabaseNameAndUUID(ctx, c) |
| 77 | if errors.Is(err, errDatabaseNotFound) { |
| 78 | io.Error("No database found. Please use --database flag.") |
| 79 | os.Exit(1) |
| 80 | } |
| 81 | if err != nil { |
| 82 | io.Error(err) |
| 83 | os.Exit(1) |
| 84 | } |
| 85 | return currentDatabase, databaseUUID |
| 86 | } |
| 87 | |
| 88 | // GetCurrentResource is the new helper to get the current resource (app or database). |
| 89 | func GetCurrentResource(ctx context.Context, c *cli.Command) string { |
no test coverage detected