chore: renamed cli from gs to kevo
Some checks failed
Go Tests / Run Tests (1.24.2) (push) Has been cancelled

This commit is contained in:
Jeremy Tregunna 2025-04-20 18:16:26 -06:00
parent 3450873ef0
commit 477cfa1817
Signed by: jer
GPG Key ID: 1278B36BA6F5D5E4
3 changed files with 24 additions and 24 deletions

View File

@ -3,7 +3,7 @@
all: build
build:
go build -o gs ./cmd/gs
go build -o kevo ./cmd/kevo
clean:
rm -f gs
rm -f kevo

View File

@ -97,10 +97,10 @@ func main() {
### 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
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
@ -109,22 +109,22 @@ directory called foo.db in /tmp where the database will live).
Example session:
```
gs> PUT user:1 {"name":"John","email":"john@example.com"}
kevo> PUT user:1 {"name":"John","email":"john@example.com"}
Value stored
gs> GET user:1
kevo> GET user:1
{"name":"John","email":"john@example.com"}
gs> BEGIN TRANSACTION
kevo> BEGIN 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)
gs> COMMIT
kevo> COMMIT
Transaction committed (0.53 ms)
gs> SCAN user:
kevo> SCAN user:
user:1: {"name":"John","email":"john@example.com"}
user:2: {"name":"Jane","email":"jane@example.com"}
2 entries found

View File

@ -40,10 +40,10 @@ var completer = readline.NewPrefixCompleter(
)
const helpText = `
Kevo (gs) - SQLite-like interface for the storage engine
Kevo (kevo) - A lightweight, minimalist, storage engine.
Usage:
gs [database_path] - Start with an optional database path
keco [database_path] - Start with an optional database path
Commands:
.help - Show this help message
@ -52,16 +52,16 @@ Commands:
.exit - Exit the program
.stats - Show database statistics
.flush - Force flush memtables to disk
BEGIN [TRANSACTION] - Begin a transaction (default: read-write)
BEGIN READONLY - Begin a read-only transaction
COMMIT - Commit the current transaction
ROLLBACK - Rollback the current transaction
PUT key value - Store a key-value pair
GET key - Retrieve a value by key
DELETE key - Delete a key-value pair
SCAN - Scan all key-value pairs
SCAN prefix - Scan key-value pairs with given prefix
SCAN RANGE start end - Scan key-value pairs in range [start, end)
@ -69,7 +69,7 @@ Commands:
`
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.")
// Initialize variables
@ -90,9 +90,9 @@ func main() {
}
// 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{
Prompt: "gs> ",
Prompt: "kevo> ",
HistoryFile: historyFile,
InterruptPrompt: "^C",
EOFPrompt: "exit",
@ -109,22 +109,22 @@ func main() {
if tx != nil {
if tx.IsReadOnly() {
if dbPath != "" {
prompt = fmt.Sprintf("gs:%s[RO]> ", dbPath)
prompt = fmt.Sprintf("kevo:%s[RO]> ", dbPath)
} else {
prompt = "gs[RO]> "
prompt = "kevo[RO]> "
}
} else {
if dbPath != "" {
prompt = fmt.Sprintf("gs:%s[RW]> ", dbPath)
prompt = fmt.Sprintf("kevo:%s[RW]> ", dbPath)
} else {
prompt = "gs[RW]> "
prompt = "kevo[RW]> "
}
}
} else {
if dbPath != "" {
prompt = fmt.Sprintf("gs:%s> ", dbPath)
prompt = fmt.Sprintf("kevo:%s> ", dbPath)
} else {
prompt = "gs> "
prompt = "kevo> "
}
}
rl.SetPrompt(prompt)