Commandline LevelDB management.
- Command line data management
- Interactive data management
- REPL features auto-complete and suggestions for keys.
- REPL automatically saves and reloads REPL history.
- Connect to a network enabled database via multilevel.
$npm install lev -g
$ lev
Will print out usage options. Note most commands have shorthand aliases
Get the first 10 keys in the database, the path is optional but if ommited a database will be created in the current working directory.
$ lev path/to/db --keys --limit 10
or short hand
$ lev path/to/db -kl 10
Get the first ten records starting at bazz
and ending at zomg
.
$ lev path/to/db --limit 10 --start 'bazz' --end 'zomg'
Get the key welcome
from inside the 2 sublevels deep
lev ./db --cd greetings/en --get 'welcome'
If no options are supplied then a REPL is provided to either the path or port specified
Options:
-c Creates a database
--del, -d Remove an entity
--get, -g Get an record based on the key
--put --value, -p Put a value into the database
e.g $ lev /path/to/db --put key --value val
Or $ lev /path/to/db -p key val
--port For connecting to a remote multilevel instance.
Use as a single option for a REPL
--keys, -k Only return keys
--limit, -l The number of entities to return
--start, -s The starting key for a read
--end, -e The end key
For connecting to a multilevel enabled instance, specify the port
parameter:
lev --port 1337 --keys ...
Start the REPL by providing only a path or host and port
$lev path/to/db
Commands in the REPL also match the API. But wait! There are a subset of commands
that make common operations faster, easier and more fun. The following keys
and
sublevels
are arbitrary and for the purpose of this example only.
Supports tab completion, same as the javascript function.
>ls
81!6dfb2cf92a411302b97a24cb977c1bd981711c
81!8613357d10da3ae2d295a53137b750d6b324b5
c9!25e7700452f8f269898cee9c18925350a6ef24
8c!699404e9c54349c32f4ca88a9ceea9382cffe9
>
Supports tab completion, same as the javascript function.
>get 81!6dfb2cf92a411302b97a24cb977c1bd981711c
{
"greeting": "hello, world!"
}
>
Supports cd ..
to navigate down a level. cd /
to navigate to the root of the database.
And cd foo/bar/bazz
to navigate up to a deeply nested sublevel in the database.
>cd 97a24cb977c1bd9
/97a24cb977c1bd9>ls
c9!b5db29d11c6556b7d5b7ffe272dcefec9edae6
You can create a .lev
file in your home directory and it will be used to set
the defaults. Command line arguments will override the default settings in this
file.
{
"createIfMissing": true,
"encoding": "json"
}