Skip to content

Commit 5a03026

Browse files
committed
doc
1 parent 94e18b7 commit 5a03026

File tree

9 files changed

+146
-161
lines changed

9 files changed

+146
-161
lines changed

astra-shell/README.MD

Lines changed: 34 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -4,154 +4,76 @@
44

55
## Overview
66

7-
Astra Shell is a standalone command line interface.
7+
_This component is in heavy development that can lead to breaking changes_
88

9-
- (1). It can be used as a stateless cli providing all options in the command line for automation purposes.
9+
## Installation
1010

11-
```
12-
astra create db
13-
--token AstraCS:...... \
14-
--name workshop \
15-
--region eu-central-1 \
16-
--keyspace nosql1
17-
```
11+
Installing ASTRA-CLI on UNIX-like platforms is as easy as ever. ASTRA-CLI installs smoothly on macOS, Linux, WSL, Cygwin, Solaris and FreeBSD. We also support Bash and ZSH shells.
1812

19-
- (2). It provides a configuration file to avoid users to enter credentials (tokens) each time.
13+
- Open a new terminal and enter:
2014

2115
```
22-
astra create db
23-
--config my_env_dev \
24-
--name workshop \
25-
--region eu-central-1 \
26-
--keyspace nosql1
27-
```
28-
29-
- (3). It provides a shell, an interactive repl with users interactions.
30-
31-
```
32-
astra --config my_env_dev
33-
34-
$myAstraOrganization>create db --name workshop --region eu-central-1 --keyspace nosql1
16+
curl -Ls curl -s "https://dtsx.io/get-astra-cli" | bash
3517
```
3618

37-
## Prequisites
19+
- Follow the instructions on-screen to complete installation. Next, open a new terminal or enter:
3820

39-
- A JRE/JDK 8+ installed is required.
21+
$ source "$HOME/.astra/install/astra-init.sh"
4022

41-
## Installations
42-
43-
- Download and extract the zip archive
23+
- Lastly, run the following code snippet to ensure that installation succeeded:
4424

4525
```
46-
unzip astra-shell-alpha1.zip
26+
astra -v
4727
```
4828

49-
- Initialization
29+
If all went well, the version should be displayed. Something like:
5030

5131
```
52-
cd astra-shell
53-
chmod 700 astra
54-
source auto-completions.bash
32+
0.3.2-SNAPSHOT
5533
```
5634

57-
- Configuration
58-
35+
## Setup
5936

60-
You are already set and can start typing commands
61-
62-
```
63-
astra show dbs -t <TOKEN>
64-
```
65-
66-
But it is annoying each time having to provide a token. What if you could save it ?
37+
- Run the following command and provide your token when needed
6738

6839
```
6940
astra setup
7041
```
7142

72-
- You can now
73-
74-
```
75-
astra show dbs
76-
```
77-
78-
## Configuration file
79-
80-
- List available configurations
43+
- You should be good to go
8144

8245
```
83-
astra show configs
8446
astra config list
8547
```
8648

87-
- Create a new configuration providing a name
88-
89-
```
90-
astra config create dev -t <TOKEN>
91-
astra config list
49+
>```
50+
+-----------------------------------------+
51+
| configuration |
52+
+-----------------------------------------+
53+
| default ([email protected]) |
54+
| DatastaxDevs |
55+
56+
+-----------------------------------------+
9257
```
9358
94-
- Show details of a dev
59+
- And access Astra
9560

9661
```
97-
astra config show dev
62+
astra db list
9863
```
9964

100-
- Set a configuration as default
101-
102-
```
103-
astra config default my_new_section
65+
>```
66+
+---------------------+--------------------------------------+---------------------+----------------+
67+
| name | id | default-region | status |
68+
+---------------------+--------------------------------------+---------------------+----------------+
69+
| mtg | dde308f5-a8b0-474d-afd6-81e5689e3e25 | eu-central-1 | ACTIVE |
70+
| workshops | 3ed83de7-d97f-4fb6-bf9f-82e9f7eafa23 | eu-west-1 | ACTIVE |
71+
| sdk_tests | 06a9675a-ca62-4cd0-9b94-aefaf395922b | us-east-1 | ACTIVE |
72+
| api_days_dubai_2022 | 53f07b2a-8856-4741-b595-72b03be56bc6 | us-east1 | ACTIVE |
73+
| free_db | 8642763c-8ba7-4ede-a031-82355c7c34a7 | us-east1 | ACTIVE |
74+
+---------------------+--------------------------------------+---------------------+----------------+
10475
```
10576
106-
- Rename on organization
10777

108-
```
109-
astra config rename my_new_section --name section2
110-
```
11178

112-
- Delete a configuration
113-
114-
```
115-
astra config delete dev
116-
astra config list
117-
```
118-
119-
## Let's start the SHOW
120-
121-
```
122-
astra show dbs
123-
```
124-
125-
```
126-
astra show roles
127-
```
128-
129-
```
130-
astra show role <ROLE>
131-
```
132-
133-
```
134-
astra show users
135-
```
136-
137-
```
138-
astra show user <USER>
139-
```
140-
141-
## Shell we started now ?
142-
143-
144-
```
145-
astra shell
146-
```
147-
148-
149-
## Configuration
150-
151-
```
152-
show config <CONFIG>
153-
config load --name <CONFIG>
154-
config save --name <CONFIG>
155-
config setdefault --name <XXX>
156-
```
15779

astra-shell/src/main/java/com/datastax/astra/shell/AstraCli.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import com.datastax.astra.shell.cmd.config.Setup;
1212
import com.datastax.astra.shell.cmd.db.Db;
1313
import com.datastax.astra.shell.cmd.db.DbCreateCli;
14-
import com.datastax.astra.shell.cmd.db.DbDelete;
14+
import com.datastax.astra.shell.cmd.db.DbDeleteCli;
1515
import com.datastax.astra.shell.cmd.db.DbListCli;
1616
import com.datastax.astra.shell.cmd.shell.ShellCommand;
1717
import com.datastax.astra.shell.utils.LoggerShell;
@@ -36,6 +36,7 @@
3636
groups = {
3737
@Group(name = Db.DB, description = "Commands acting of database", commands = {
3838
DbCreateCli.class,
39+
DbDeleteCli.class,
3940
DbListCli.class
4041
}),
4142
@Group(name = "config", description = "Edit configuration file", commands = {

astra-shell/src/main/java/com/datastax/astra/shell/AstraShell.java

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
import com.datastax.astra.shell.cmd.ExitCommand;
44
import com.datastax.astra.shell.cmd.HelpCommand;
55
import com.datastax.astra.shell.cmd.QuitCommand;
6+
import com.datastax.astra.shell.cmd.db.Db;
7+
import com.datastax.astra.shell.cmd.db.DbCreateShell;
8+
import com.datastax.astra.shell.cmd.db.DbDeleteShell;
69
import com.datastax.astra.shell.cmd.db.DbListShell;
7-
import com.datastax.astra.shell.cmd.iam.ShowRoleCommand;
8-
import com.datastax.astra.shell.cmd.iam.ShowRolesCommand;
9-
import com.datastax.astra.shell.cmd.iam.ShowUserCommand;
10-
import com.datastax.astra.shell.cmd.iam.ShowUsersCommands;
1110
import com.datastax.astra.shell.cmd.shell.ConnectCommand;
1211
import com.datastax.astra.shell.cmd.shell.CqlShCommand;
1312
import com.datastax.astra.shell.cmd.shell.EmptyCommand;
14-
import com.datastax.astra.shell.cmd.show.ShowConfigsCommand;
1513
import com.datastax.astra.shell.cmd.use.UseDb;
1614
import com.datastax.astra.shell.utils.LoggerShell;
1715
import com.github.rvesse.airline.annotations.Cli;
@@ -37,20 +35,16 @@
3735
CqlShCommand.class
3836
},
3937
groups = {
40-
@Group(
41-
name = "show",
42-
description = "Listing details of an entity or entity list",
43-
commands = {
44-
DbListShell.class,
45-
ShowRoleCommand.class, ShowRolesCommand.class,
46-
ShowUserCommand.class, ShowUsersCommands.class,
47-
ShowConfigsCommand.class }
48-
),
38+
@Group(name = Db.DB, description = "Commands acting of database", commands = {
39+
DbCreateShell.class,
40+
DbDeleteShell.class,
41+
DbListShell.class
42+
}),
4943
@Group(
5044
name = "use",
5145
description = "Focus on an entity (context & prompt changed)",
5246
commands = {
53-
UseDb.class
47+
UseDb.class
5448
}
5549
)
5650
})

astra-shell/src/main/java/com/datastax/astra/shell/cmd/HelpCommand.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,5 @@ public class HelpCommand<T> extends Help<T> {
1717
@Override
1818
public void run() {
1919
super.run();
20-
/*
21-
try {
22-
if (!command.isEmpty()) {
23-
new CliGlobalUsageSummaryGenerator<T>(false)
24-
.usage(global, System.out);
25-
return;
26-
}
27-
} catch (IOException e) {
28-
throw new RuntimeException("Error generating usage documentation", e);
29-
}*/
3020
}
3121
}

0 commit comments

Comments
 (0)