Skip to content

Commands

John Green edited this page Mar 1, 2017 · 2 revisions

Commands

Bolt Inspector has 12 commands as of the latest release (February 28, 2017).

Bucket

Code Location: Command_Bucket

The bucket command is used to create a new bucket.

[example.db] (~/) $>bucket <path>

<path> is the path where you want the bucket to be made. Buckets can be created at the root of the database, or within other buckets.

CD

Code Location: Command_CD

The cd command is used to move around the database.

[example.db] (~/) $>cd <path>

<path> is the path you wish to move to.

Copy

Code Location: Command_Copy

The copy command is used to copy a value from one key to another.

[example.db] (~/) $>copy <source path> <destination path>

<source path> is the source value, which is then copied to the path <destination path>.

Delete

Code Location: Command_Delete

The delete command is used to delete a value or a bucket.

[example.db] (~/) $>delete <path>

<path> is the path to the bucket or value that you wish to delete. Bolt Inspector will ask for confirmation prior to deleting anything.

Empty

Code Location: Command_Empty

The empty command is used to delete all the values in a bucket, while leaving the target bucket intact.

[example.db] (~/) $>empty [path]

[path] is an optional path to a bucket to empty. If no path is given, it will empty the current bucket. It will, like the delete command, ask for confirmation prior to deleting anything.

Exit

Code Location: BoltInspector

The exit command is used to terminate the program.

[example.db] (~/) $>exit

Help

Code Location: Command_Help

The help command lists all the commands with a short description. It will also let you get help with specific commands.

[example.db] (~/) $>help [?]

[?] is an optional argument for specifying what you need help with. As of right now, it accepts the name of any of these commands.

List

Code Location: Command_List

The list command is used to list all of the buckets and values in the current bucket.

[example.db] (~/) $>list [k|b] [v]

There are several optional arguments for the list command. The order they're given does not matter.

k tells list to only show non-bucket keys

b tells list to only show bucket keys.

if both k and b are set, list uses whichever is put last

v tells list to print more details (verbose mode)

Move

Code Location: Command_Copy

The move command is used to move a value from a given path to another path.

[example.db] (~/) $>move <source path> <destination path>

<source path> is the source value, which is then moved to the path <destination path>.

Not important for most cases, but BoltDB doesn't actually support moving values around. So, technically, what this does is leverage the copy command to copy the source to the destination, and then delete the source.

Print

Code Location: Command_Print

The print command is used to display the the value stored at a given path.

[example.db] (~/) $>print <path> [s|i|ui|b]

path is the path of the value. The next, optional arguments specify how to print it.

s prints as a string

i prints as a signed int(32)

ui prints as an unsigned int(32)

b prints an array of bytes

If more than one is given, print will display all of them, in the order they are given. So if you enter:

[example.db] (~/bucket) $>print val s i b

What you'll get back is:

String: example Signed Int: 1023 Byte String: [255 3 0 0 0 0 0 0]

And if a value can't be interpreted correctly, it will say that instead of printing a value.

RList

Code Location: Command_RecursiveList

The rlist command is the brother of the list command, with the main difference being that this one is recursive.

[example.db] (~/) $>rlist [v] [depth=<int>]

Just like with list, v toggles verbose mode (showing more information). The next argument is the recursion depth.

depth=<int> tells rlist to stop after going that many levels down. This defaults to 3

d=<int> is an alias for depth=<int>

Write

Code Location: Command_Write

The write command is used to insert values to the database.

[example.db] (~/) $>write <path> <value> [s|i|ui]

<path> is where you want the value written, and <value> is what you want it to write. By default, values are interpreted as strings.

If you want to write the value as a signed int value, you can use the argument i.

Likewise, if you want to write it as an unsigned int, you can use the argument ui.

Clone this wiki locally