chore: renamed cli from gs to kevo
Some checks failed
Go Tests / Run Tests (1.24.2) (push) Has been cancelled
Some checks failed
Go Tests / Run Tests (1.24.2) (push) Has been cancelled
This commit is contained in:
parent
3450873ef0
commit
477cfa1817
4
Makefile
4
Makefile
@ -3,7 +3,7 @@
|
|||||||
all: build
|
all: build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
go build -o gs ./cmd/gs
|
go build -o kevo ./cmd/kevo
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f gs
|
rm -f kevo
|
||||||
|
16
README.md
16
README.md
@ -97,10 +97,10 @@ func main() {
|
|||||||
|
|
||||||
### Interactive CLI Tool
|
### Interactive CLI Tool
|
||||||
|
|
||||||
Included is an interactive CLI tool (`gs`) for exploring and manipulating databases:
|
Included is an interactive CLI tool (`kevo`) for exploring and manipulating databases:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go run ./cmd/gs/main.go [database_path]
|
go run ./cmd/kevo/main.go [database_path]
|
||||||
```
|
```
|
||||||
|
|
||||||
Will create a directory at the path you create (e.g., /tmp/foo.db will be a
|
Will create a directory at the path you create (e.g., /tmp/foo.db will be a
|
||||||
@ -109,22 +109,22 @@ directory called foo.db in /tmp where the database will live).
|
|||||||
Example session:
|
Example session:
|
||||||
|
|
||||||
```
|
```
|
||||||
gs> PUT user:1 {"name":"John","email":"john@example.com"}
|
kevo> PUT user:1 {"name":"John","email":"john@example.com"}
|
||||||
Value stored
|
Value stored
|
||||||
|
|
||||||
gs> GET user:1
|
kevo> GET user:1
|
||||||
{"name":"John","email":"john@example.com"}
|
{"name":"John","email":"john@example.com"}
|
||||||
|
|
||||||
gs> BEGIN TRANSACTION
|
kevo> BEGIN TRANSACTION
|
||||||
Started read-write transaction
|
Started read-write transaction
|
||||||
|
|
||||||
gs> PUT user:2 {"name":"Jane","email":"jane@example.com"}
|
kevo> PUT user:2 {"name":"Jane","email":"jane@example.com"}
|
||||||
Value stored in transaction (will be visible after commit)
|
Value stored in transaction (will be visible after commit)
|
||||||
|
|
||||||
gs> COMMIT
|
kevo> COMMIT
|
||||||
Transaction committed (0.53 ms)
|
Transaction committed (0.53 ms)
|
||||||
|
|
||||||
gs> SCAN user:
|
kevo> SCAN user:
|
||||||
user:1: {"name":"John","email":"john@example.com"}
|
user:1: {"name":"John","email":"john@example.com"}
|
||||||
user:2: {"name":"Jane","email":"jane@example.com"}
|
user:2: {"name":"Jane","email":"jane@example.com"}
|
||||||
2 entries found
|
2 entries found
|
||||||
|
@ -40,10 +40,10 @@ var completer = readline.NewPrefixCompleter(
|
|||||||
)
|
)
|
||||||
|
|
||||||
const helpText = `
|
const helpText = `
|
||||||
Kevo (gs) - SQLite-like interface for the storage engine
|
Kevo (kevo) - A lightweight, minimalist, storage engine.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
gs [database_path] - Start with an optional database path
|
keco [database_path] - Start with an optional database path
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
.help - Show this help message
|
.help - Show this help message
|
||||||
@ -52,16 +52,16 @@ Commands:
|
|||||||
.exit - Exit the program
|
.exit - Exit the program
|
||||||
.stats - Show database statistics
|
.stats - Show database statistics
|
||||||
.flush - Force flush memtables to disk
|
.flush - Force flush memtables to disk
|
||||||
|
|
||||||
BEGIN [TRANSACTION] - Begin a transaction (default: read-write)
|
BEGIN [TRANSACTION] - Begin a transaction (default: read-write)
|
||||||
BEGIN READONLY - Begin a read-only transaction
|
BEGIN READONLY - Begin a read-only transaction
|
||||||
COMMIT - Commit the current transaction
|
COMMIT - Commit the current transaction
|
||||||
ROLLBACK - Rollback the current transaction
|
ROLLBACK - Rollback the current transaction
|
||||||
|
|
||||||
PUT key value - Store a key-value pair
|
PUT key value - Store a key-value pair
|
||||||
GET key - Retrieve a value by key
|
GET key - Retrieve a value by key
|
||||||
DELETE key - Delete a key-value pair
|
DELETE key - Delete a key-value pair
|
||||||
|
|
||||||
SCAN - Scan all key-value pairs
|
SCAN - Scan all key-value pairs
|
||||||
SCAN prefix - Scan key-value pairs with given prefix
|
SCAN prefix - Scan key-value pairs with given prefix
|
||||||
SCAN RANGE start end - Scan key-value pairs in range [start, end)
|
SCAN RANGE start end - Scan key-value pairs in range [start, end)
|
||||||
@ -69,7 +69,7 @@ Commands:
|
|||||||
`
|
`
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("Kevo (gs) version 1.0.0")
|
fmt.Println("Kevo (kevo) version 1.0.2")
|
||||||
fmt.Println("Enter .help for usage hints.")
|
fmt.Println("Enter .help for usage hints.")
|
||||||
|
|
||||||
// Initialize variables
|
// Initialize variables
|
||||||
@ -90,9 +90,9 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Setup readline with history support
|
// Setup readline with history support
|
||||||
historyFile := filepath.Join(os.TempDir(), ".gs_history")
|
historyFile := filepath.Join(os.TempDir(), ".kevo_history")
|
||||||
rl, err := readline.NewEx(&readline.Config{
|
rl, err := readline.NewEx(&readline.Config{
|
||||||
Prompt: "gs> ",
|
Prompt: "kevo> ",
|
||||||
HistoryFile: historyFile,
|
HistoryFile: historyFile,
|
||||||
InterruptPrompt: "^C",
|
InterruptPrompt: "^C",
|
||||||
EOFPrompt: "exit",
|
EOFPrompt: "exit",
|
||||||
@ -109,22 +109,22 @@ func main() {
|
|||||||
if tx != nil {
|
if tx != nil {
|
||||||
if tx.IsReadOnly() {
|
if tx.IsReadOnly() {
|
||||||
if dbPath != "" {
|
if dbPath != "" {
|
||||||
prompt = fmt.Sprintf("gs:%s[RO]> ", dbPath)
|
prompt = fmt.Sprintf("kevo:%s[RO]> ", dbPath)
|
||||||
} else {
|
} else {
|
||||||
prompt = "gs[RO]> "
|
prompt = "kevo[RO]> "
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if dbPath != "" {
|
if dbPath != "" {
|
||||||
prompt = fmt.Sprintf("gs:%s[RW]> ", dbPath)
|
prompt = fmt.Sprintf("kevo:%s[RW]> ", dbPath)
|
||||||
} else {
|
} else {
|
||||||
prompt = "gs[RW]> "
|
prompt = "kevo[RW]> "
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if dbPath != "" {
|
if dbPath != "" {
|
||||||
prompt = fmt.Sprintf("gs:%s> ", dbPath)
|
prompt = fmt.Sprintf("kevo:%s> ", dbPath)
|
||||||
} else {
|
} else {
|
||||||
prompt = "gs> "
|
prompt = "kevo> "
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rl.SetPrompt(prompt)
|
rl.SetPrompt(prompt)
|
Loading…
Reference in New Issue
Block a user