Command utility for operations on a sophia database
C C++ Shell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
deps
man
src
test
.gitignore
.travis.yml
LICENSE
Makefile
README.md
install.sh
package.json
sphia-test

README.md

sphia(1) - cli tool for sophia databases

Command utility for operations on a sophia database

Build Status

Install

Before installing sphia, you'll need to install the Sophia libraries.

With clib:

$ clib install sphia/sphia

With git:

$ git clone git@github.com:sphia/sphia.git /tmp/sphia
$ make -C /tmp/sphia make install

Via curl:

$ curl -Lo- https://raw.github.com/sphia/sphia/master/install.sh | bash

Setup

Set the SPHIA_PATH environment variable for your default database path. It will otherwise attempt to read from your current working database.

$ export SPHIA_PATH=~/db
$ sphia set -k name -v "Joseph Werle"

Usage

$ sphia

Commands

Initialize a new database with a given path:

$ sphia init --path <path>

Get a value by key:

$ sphia get -k <key>

Set a value by key:

$ sphia set -k <key -v <value>

List all keys and values:

$ sphia ls --path <path>

Clear database of all keys:

$ sphia clear --path <path>

Get status on a database (will exit with 1 or 0 code):

$ sphia st --path <path>

Purge a database of all corrupt and incomplete data:

$ sphia purge --path <path>

Reset database of all data:

$ sphia reset --path <path>

Get key count:

$ sphia count --path <path>

Search for a key or value:

$ sphia search --key <key> --value <value>

Options

Output sphia version:

$ sphia --version
0.0.1

Output help information:

$ sphia --help
usage: sphia <command> [--key <key>] [--value <value>] [--path <path>]
                       [--version] [--help]

commands:
   init                         initialize a new database
   get -k <key>                 get a value by key
   set -k <key> -v <value>      set a value by key
   rm -k <key>                  remove a value by key
   ls                           list all keys and values
   clear                        clears database of all keys
   st                           check status of database
   purge                        purge database of all corrupt and incomplete data
   reset                        reset database of all data
   count                        get key count
   search [-k <arg>] [-v <arg>] search for a key or value

options:
  -V, --version                 output program version
  -h, --help                    output help information
  -V, --verbose                 enable verbose output
  -p, --path <path>             set the path
  -k, --key <name>              key to get
  -v, --value <name>            value to set
  -s, --strict                  strict mode for a command

Turn on verbose output:

$ sphia ls --path ~/db --verbose
path set to '/Users/jwerle`
name = 'Joe'
age = 23

Set the database path (defaults to working directory):

$ sphia clear --path ~/db
Cleared sophia database at path '/Users/jwerle'

Set the key and/or value to get or set command:

$ sphia set --key name --value "Joseph Werle"
name = 'Joseph Werle'

Contributors

See contributors

Contributing

See Contributing

License

MIT