Inaba SDBM Manipulator
Introduction
Inaba SDBM Manipulator is a command line tool to manipulate SDBM database.
Operation Environment
We checked good operation within following environment.
- Linux(openSUSE 12.2)・Mac OS X 10.8.2
- Ruby 1.9.3
Architectonics
- bin
- inaba :: Executable script
- doc :: Documents generated by rdoc
- lib
- inaba
- manipulator.rb :: Manipulator class
- Rakefile :: Rakefile that is used to generate gem file
- test
- tb_manipulator.rb :: Unit test of Manipulator
Depended libraries
Install
Download inaba-x.y.z.gem, then execute following command to install Inaba.
$ sudo gem install inaba-x.y.z.gem
On the other hand, you can install from RubyGems.org to use following command.
$ sudo gem install inaba
Tutorial
Configuration of environment variable
Set file path of SDBM database to environment variable named $INABA_DB. If target database file is named rabbit.sdb, use following command in bash.
$ export INABA_DB="rabbit.sdb"
Add key value pair
Use add command to add a value to key.
$ inaba add rabbit RABBIT
Use list command to show key value pairs.
$ inaba list
[rabbit]:RABBIT
Add more pairs.
$ inaba add bunny BUNNY
$ inaba add hare HARE
$ inaba list
[rabbit]:RABBIT
[bunny]:BUNNY
[hare]:HARE
Inaba can output a pair list with CSV format.
$ inaba csv
rabbit,RABBIT
bunny,BUNNY
hare,HARE
Also use keys command to list keys.
$ inaba keys
rabbit, bunny, hare,
Values command works listing values.
$ inaba values
RABBIT, BUNNY, HARE,
Use del command to delete key value command.
$ inaba del rabbit
$ inaba list
[bunny]:BUNNY
[hare]:HARE
Clear command removes all key value pairs.
$ inaba clear
Commands reference
コマンド | 引数 | 説明 |
---|---|---|
add | key value | Add value to key |
del | key | Delete a value associated with key |
list | Output key value pairs | |
keys | Output keys | |
values | Output values | |
csv | Output pairs with CSV format | |
help | Output command list |
License
Inaba is distributed with MIT License. See the LICENSE file to read the detail of license.
About Author
Moza USANE
http://blog.quellencode.org/
[email protected]