Giter Club home page Giter Club logo

lev's Introduction

SYNOPSIS

Commandline LevelDB management.

FEATURES

  • 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.

INSTALLATION

$npm install lev -g

CLI EXAMPLES

$ 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'

CLI OPTIONS

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 ...

REPL

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.

ls A listing of keys in the current sublevel

Supports tab completion, same as the javascript function.

>ls
81!6dfb2cf92a411302b97a24cb977c1bd981711c
81!8613357d10da3ae2d295a53137b750d6b324b5
c9!25e7700452f8f269898cee9c18925350a6ef24
8c!699404e9c54349c32f4ca88a9ceea9382cffe9
>

get Get the value of a key and inpspect it if possible

Supports tab completion, same as the javascript function.

>get 81!6dfb2cf92a411302b97a24cb977c1bd981711c
{
  "greeting": "hello, world!"
}
>

cd create or change into a sublevel

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

Default Configuration

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"
}

lev's People

Contributors

brycebaril avatar heapwolf avatar juliangruber avatar no9 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.