@petradb/cli 1.0.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -38
- package/bin/main.js +5159 -5035
- package/bin/petradb +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @petradb/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Interactive SQL shell and batch execution tool for PetraDB.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -10,58 +10,24 @@ npm install -g @petradb/cli
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
-
### Interactive REPL
|
|
14
|
-
|
|
15
13
|
```bash
|
|
16
14
|
# In-memory database
|
|
17
15
|
petradb -m
|
|
18
16
|
|
|
19
17
|
# Persistent database (creates or opens)
|
|
20
18
|
petradb mydb.petra
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### Batch execution
|
|
24
19
|
|
|
25
|
-
```bash
|
|
26
20
|
# Execute a SQL file
|
|
27
21
|
petradb -m -f schema.sql
|
|
28
22
|
|
|
29
23
|
# Execute inline SQL
|
|
30
|
-
petradb -m -e "
|
|
31
|
-
|
|
32
|
-
# Multiple operations
|
|
33
|
-
petradb -m -f schema.sql -f seed.sql -e "SELECT * FROM users;"
|
|
34
|
-
|
|
35
|
-
# Read SQL from stdin
|
|
36
|
-
echo "SELECT 1 + 1;" | petradb -m --stdin
|
|
24
|
+
petradb -m -e "SELECT 1 + 1;"
|
|
37
25
|
```
|
|
38
26
|
|
|
39
|
-
## Flags
|
|
40
|
-
|
|
41
|
-
| Flag | Short | Description |
|
|
42
|
-
|------|-------|-------------|
|
|
43
|
-
| `--memory` | `-m` | Use in-memory database |
|
|
44
|
-
| `--file <path>` | `-f` | Execute SQL file (repeatable) |
|
|
45
|
-
| `--execute <sql>` | `-e` | Execute SQL string (repeatable) |
|
|
46
|
-
| `--stdin` | | Read SQL from stdin |
|
|
47
|
-
| `--path <path>` | | Database file path |
|
|
48
|
-
|
|
49
|
-
## Meta-commands
|
|
50
|
-
|
|
51
|
-
Inside the interactive REPL:
|
|
52
|
-
|
|
53
|
-
| Command | Description |
|
|
54
|
-
|---------|-------------|
|
|
55
|
-
| `\dt` | List all tables |
|
|
56
|
-
| `\d <table>` | Describe a table's columns |
|
|
57
|
-
| `\i <file>` | Execute a SQL file |
|
|
58
|
-
| `\dump` | Dump the database schema |
|
|
59
|
-
| `\q` | Quit |
|
|
60
|
-
|
|
61
27
|
## Documentation
|
|
62
28
|
|
|
63
|
-
Full documentation at [petradb.dev](https://petradb.dev)
|
|
29
|
+
Full documentation at **[petradb.dev](https://petradb.dev)**.
|
|
64
30
|
|
|
65
31
|
## License
|
|
66
32
|
|
|
67
|
-
ISC
|
|
33
|
+
[ISC](https://opensource.org/licenses/ISC)
|