3
3
import org .fusesource .jansi .AnsiConsole ;
4
4
5
5
import com .datastax .astra .shell .cmd .HelpCommand ;
6
- import com .datastax .astra .shell .cmd .config .ConfigCreateCommand ;
7
- import com .datastax .astra .shell .cmd .config .ConfigDefaultCommand ;
8
- import com .datastax .astra .shell .cmd .config .ConfigDeleteCommand ;
9
- import com .datastax .astra .shell .cmd .config .ConfigListCommand ;
10
- import com .datastax .astra .shell .cmd .config .ConfigShowCommand ;
11
- import com .datastax .astra .shell .cmd .config .SetupCommand ;
12
- import com .datastax .astra .shell .cmd .db .CreateDatabaseCommand ;
13
- import com .datastax .astra .shell .cmd .db .DatabaseCommandUtils ;
14
- import com .datastax .astra .shell .cmd .db .CreateDatabaseCommand .CreateDatabaseCommandAlias1 ;
15
- import com .datastax .astra .shell .cmd .db .DeleteDatabaseCommand ;
16
- import com .datastax .astra .shell .cmd .db .DeleteDatabaseCommand .DeleteDatabaseCommandAlias1 ;
17
- import com .datastax .astra .shell .cmd .db .ShowDatabaseCommand ;
18
- import com .datastax .astra .shell .cmd .db .ShowDatabasesCommand ;
19
- import com .datastax .astra .shell .cmd .db .ShowDatabasesCommand .ShowDatabasesCommandBis ;
20
- import com .datastax .astra .shell .cmd .iam .ShowRoleCommand ;
21
- import com .datastax .astra .shell .cmd .iam .ShowRolesCommand ;
22
- import com .datastax .astra .shell .cmd .iam .ShowUserCommand ;
23
- import com .datastax .astra .shell .cmd .iam .ShowUsersCommands ;
6
+ import com .datastax .astra .shell .cmd .config .ConfigCreate ;
7
+ import com .datastax .astra .shell .cmd .config .ConfigDefault ;
8
+ import com .datastax .astra .shell .cmd .config .ConfigDelete ;
9
+ import com .datastax .astra .shell .cmd .config .ConfigList ;
10
+ import com .datastax .astra .shell .cmd .config .ConfigShow ;
11
+ import com .datastax .astra .shell .cmd .config .Setup ;
12
+ import com .datastax .astra .shell .cmd .db .Db ;
13
+ import com .datastax .astra .shell .cmd .db .DbCreateCli ;
14
+ import com .datastax .astra .shell .cmd .db .DbDelete ;
15
+ import com .datastax .astra .shell .cmd .db .DbListCli ;
24
16
import com .datastax .astra .shell .cmd .shell .ShellCommand ;
25
- import com .datastax .astra .shell .cmd .show .ShowConfigCommand ;
26
- import com .datastax .astra .shell .cmd .show .ShowConfigsCommand ;
27
17
import com .datastax .astra .shell .utils .LoggerShell ;
28
18
import com .github .rvesse .airline .annotations .Cli ;
29
19
import com .github .rvesse .airline .annotations .Group ;
39
29
description = "CLI for DataStax Astra™ including an interactive mode" ,
40
30
defaultCommand = ShellCommand .class , // no command => interactive
41
31
commands = {
42
- SetupCommand .class ,
32
+ Setup .class ,
43
33
HelpCommand .class ,
44
34
ShellCommand .class
45
35
},
46
36
groups = {
47
- @ Group (
48
- name = "show" , description = "Display entity details or list entities" ,
49
- commands = {
50
- // List Db in the organization (dbs | databases)
51
- ShowDatabasesCommand .class ,
52
- ShowDatabasesCommandBis .class ,
53
- // List Roles in the current organization/tenant
54
- ShowRolesCommand .class ,
55
- // Display details of a role (permissions)
56
- ShowRoleCommand .class ,
57
- // Display details of a user (roles, permissions, metadata)
58
- ShowUserCommand .class ,
59
- // List Users in the current organization/tenant
60
- ShowUsersCommands .class ,
61
- // Show current configuration
62
- ShowConfigsCommand .class ,
63
- ShowConfigCommand .class
64
- }
65
- ),
66
- @ Group (
67
- name = "list" , description = "Display list of entities" ,
68
- commands = {
69
- // List Db in the organization (dbs | databases)
70
- ShowDatabaseCommand .class ,
71
- ShowDatabasesCommand .class ,
72
- ShowDatabasesCommandBis .class ,
73
- ShowRolesCommand .class ,
74
- ShowUsersCommands .class ,
75
- ShowConfigsCommand .class ,
76
- ShowConfigCommand .class
77
- }
78
- ),
79
- @ Group (
80
- name = "config" ,
81
- description = "Edit configuration file" ,
82
- commands = {
83
- ConfigCreateCommand .class ,
84
- ConfigDefaultCommand .class ,
85
- ConfigDeleteCommand .class ,
86
- ConfigShowCommand .class ,
87
- ConfigListCommand .class
88
- }
89
- ),
90
- @ Group (
91
- name = "create" ,
92
- description = "Create entities (db, tenant, user, role...)" ,
93
- commands = {
94
- CreateDatabaseCommand .class ,
95
- CreateDatabaseCommandAlias1 .class
96
- }
97
- ),
98
- @ Group (
99
- name = "delete" ,
100
- description = "Delete existing entities (db, tenant, user, role...)" ,
101
- commands = {
102
- DeleteDatabaseCommand .class ,
103
- DeleteDatabaseCommandAlias1 .class ,
104
- }
105
- ),
106
- // Noun then verb
107
- @ Group (
108
- name = DatabaseCommandUtils .DB ,
109
- description = "Commands at Database level" ,
110
- commands = {
111
- CreateDatabaseCommand .class ,
112
- CreateDatabaseCommandAlias1 .class
113
- }
37
+ @ Group (name = Db .DB , description = "Commands acting of database" , commands = {
38
+ DbCreateCli .class ,
39
+ DbListCli .class
40
+ }),
41
+ @ Group (name = "config" , description = "Edit configuration file" , commands = {
42
+ ConfigCreate .class ,
43
+ ConfigDefault .class ,
44
+ ConfigDelete .class ,
45
+ ConfigShow .class ,
46
+ ConfigList .class
47
+ }
114
48
),
115
49
})
116
50
public class AstraCli {
@@ -135,10 +69,10 @@ public static void main(String[] args) {
135
69
136
70
} catch (ParseArgumentsUnexpectedException ex ) {
137
71
LoggerShell .error ("Invalid command: " + ex .getMessage ());
138
- ex .printStackTrace ();
72
+ // ex.printStackTrace();
139
73
} catch (Exception e ) {
140
74
LoggerShell .error ("Execution error:" + e .getMessage ());
141
- e .printStackTrace ();
75
+ // e.printStackTrace();
142
76
}
143
77
}
144
78
@@ -152,4 +86,5 @@ public static void exec(String ...args) {
152
86
main (args );
153
87
}
154
88
89
+
155
90
}
0 commit comments