0.2.7 • Published 10 years ago

lightstore-cli v0.2.7

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

LightStore CLI

Command line interface for LightStore.

Installation

npm install -g lightstore-cli

Usage

lightstore [filename.ls] [JavaScript expression]

The LightStore CLI gives you a prompt-based interface where you can run JavaScript expressions as it were a Node prompt. Alternatively, you can specify a file name and expression up front, and have only that ran by the LightStore engine.

LightStore gives you the following globals (apart from the regular JS and Node globals):

  • ls: Reference to the query API. Instance of lightstore.PersistedTree, which inherits from sntls.Tree.
  • open(): Opens a datastore file for read/write. You can check the current file name via ls.file.
  • exit(): Shorthand for exiting the CLI. Calls process.exit().

###Examples

Fetches datastore contents, dumps them to stdout and exits

$ lightstore test.js 'ls.items'

Sets a value in the datastore

$ lightstore test.js
> ls.setNode('foo>bar'.toPath(), "hello")
> ls.items
{
  "foo": {
    "bar": "hello"
  }
}

Queries paths grouped by employee last names and saves the resulting data set to file in LightStore format. Illustrates how LightStore allows all transformations available through sntls.

$ lightstore employees.ls
> ls.queryPathValuePairsAsHash('|>firstName'.toQuery())
    .toStringDictionary()
    .reverse()
    .toPersistedTree('firstNames.ls')
    .save()
0.2.7

10 years ago

0.2.6

10 years ago

0.2.5

10 years ago

0.2.4

11 years ago

0.2.3

11 years ago

0.2.2

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.1

11 years ago