-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathstatus_command.dart
More file actions
49 lines (39 loc) · 1.33 KB
/
status_command.dart
File metadata and controls
49 lines (39 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import 'package:celest_cli/src/commands/authenticate.dart';
import 'package:celest_cli/src/commands/celest_command.dart';
import 'package:celest_cli/src/context.dart';
import 'package:celest_cli/src/init/project_init.dart';
import 'package:celest_cli/src/utils/recase.dart';
import 'package:mason_logger/mason_logger.dart';
final class StatusCommand extends CelestCommand with Configure, Authenticate {
StatusCommand();
@override
String get description => 'Gets the status of the Celest Cloud project.';
@override
String get name => 'status';
@override
String get category => 'Project';
@override
Progress? currentProgress;
@override
Future<int> run() async {
await super.run();
await assertAuthenticated();
await configure();
final projectName = celestProject.projectName.paramCase;
final projectEnvironment = await cloud.projects.environments
.get('projects/$projectName/environments/production');
if (projectEnvironment == null) {
cliLogger.warn(
'This project has not been deployed yet. '
'Run `celest deploy` to deploy it.',
);
return 1;
}
cliLogger
..success('🚀 Project is live on Celest Cloud!')
..info('Project: $projectName')
..info('Environment: production')
..info('URL: ${projectEnvironment.uri}');
return 0;
}
}