From 477cfa181777b3c7ee50340ca648da0e390ea3af Mon Sep 17 00:00:00 2001 From: Jeremy Tregunna Date: Sun, 20 Apr 2025 18:16:26 -0600 Subject: [PATCH] chore: renamed cli from gs to kevo --- Makefile | 4 ++-- README.md | 16 ++++++++-------- cmd/{gs => kevo}/main.go | 28 ++++++++++++++-------------- 3 files changed, 24 insertions(+), 24 deletions(-) rename cmd/{gs => kevo}/main.go (96%) diff --git a/Makefile b/Makefile index 915dc6c..704944c 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index b79eff1..b2908aa 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/cmd/gs/main.go b/cmd/kevo/main.go similarity index 96% rename from cmd/gs/main.go rename to cmd/kevo/main.go index 028ec52..7ca7d7b 100644 --- a/cmd/gs/main.go +++ b/cmd/kevo/main.go @@ -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)