| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
badger-cli is a simple command-line interface for interacting with Badger DB, a fast key-value database written in Go.
Install using homebrew:
brew install lovromazgon/tap/badger-cliOr build it from source using Go:
go install github.com/lovromazgon/badger-cliOr download the binary manually from the latest release.
$ badger-cli -h
Usage: badger-cli [options] <database_path>
A command-line interface for a Badger key-value database.
Options:
-r, --readonly Open database in read-only mode
-b, --bypass-lock Skip the Badger directory lock (requires --readonly)
-h, --help Show help
Examples:
badger-cli /path/to/db
badger-cli --readonly /path/to/db
badger-cli --readonly --bypass-lock /path/to/dbTo open the database in read-only mode (useful for inspecting production databases safely):
badger-cli --readonly /path/to/your/badger/db
# or
badger-cli -r /path/to/your/badger/dbIn read-only mode:
To inspect a database that another process currently has open, add the --bypass-lock (-b) flag to skip Badger's directory lock:
badger-cli --readonly --bypass-lock /path/to/your/badger/db
# or
badger-cli -r -b /path/to/your/badger/dbThis flag can only be used together with --readonly, since bypassing the lock for writable access is unsafe.
Once the CLI is running, you can use the following commands:
Normal mode:
> set mykey myvalue
Value set successfully
> get mykey
myvalue
> list my*
mykey
> delete mykey
Value deleted successfully
> list
No matching keys found
> exitRead-only mode:
[READONLY] > get mykey
myvalue
[READONLY] > list my*
mykey
[READONLY] > set newkey newvalue
Error: Cannot set values in read-only mode
[READONLY] > delete mykey
Error: Cannot delete values in read-only mode
[READONLY] > exitThe list command supports glob pattern matching:
Examples:
The initial version of this CLI was developed with assistance from an AI language model. The code has since been modified and expanded.
| Back | FazBrowse Home | New Git URL |