rlx

Command line interface for couchdb

npm install rlx
3 downloads in the last week
12 downloads in the last month

rlx(1)

Command line interface for couchdb.

Features

  • UNIX style commands such as cd, pwd, ls and rm.
  • Pretty print JSON documents with support for perl, python, node and ruby, configurable with the lang setting.
  • Validate JSON before sending to a server, configurable with the lint setting.
  • Syntax highlighting is available using either source-highlight or pygmentize.
  • View large documents using less, disabled by default but may be toggled with the usepager setting.
  • Toggle display of network requests with the verbose setting.
  • Configure default server and database with the server and database settings.
  • Use the save command to save response documents to files.
  • Familiar readline line editing with command history
  • Inline manual with the help command.

Authentication API

  • Login and logout from servers using the login and logout commands.
  • Create, edit and delete from the users database with the user commands.
  • Retrieve information about the current session with the whoami and session commands.
  • Switch between authenticated servers within the same terminal session.
  • Create, list and delete server administrators with the admin commands.
  • Modify database-level administrators and members with the security commands.
  • Use the passwd command to change passwords.

Note that no client-side password generation is performed so you must be using couchdb 1.2.0 or later to be able to generate hashed passwords on the server.

Server API

  • View server statistics with the stats command.
  • View server logs with the log command.
  • Restart a server with the restart command.
  • View active tasks with the tasks command.
  • Generate uuids with the uuids command.
  • View server version with the version command.

Configuration API

  • View server configuration with the config get command.
  • Edit server configuration keys with the config set command.
  • Delete server configuration keys with the config rm command.

Database API

  • Select a database with the db command.
  • List databases with the db ls command.
  • Add databases with the db add command.
  • Delete databases with the db rm command.
  • View database information with the db info command.
  • Compact a database with the db compact command.
  • Perform view cleanup with the db cleanup command.
  • Synchronize uncommitted changes with the db commit command.
  • View changes with the db changes command.
  • Get and set the revisions limit with the db revslimit command.

Document API

  • List document with the doc ls command.
  • Create documents with the doc add command.
  • Edit documents with the doc edit command.
  • Delete documents with the doc rm command.
  • View documents with the doc get command.
  • Inspect HTTP headers with the doc head command.
  • Retrieve the revision with the doc etag command.
  • Copy documents with the doc copy command.
  • Add, update and delete documents in bulk using the bulk commands.
  • Include more information about documents using the revs, revsinfo, conflicts and seq sub-commands of the doc command.

Attachments API

  • Attach a file with the attach command.
  • Attach multiple files with the attach files command, supports simple directory globbing.
  • Delete multiple attachments with the attach rm command.
  • Download multiple attachments with the attach get command.

Note that only standalone attachments are supported, there are no plans to support inline attachments.

Replication API

  • Use the repl sub-commands add, ls, edit, rm and get to manipulate replications.
  • Determines replication database name from the server configuration and verifies the database exists.
  • Use repl filter to create a replication document that represents a filtered replication.
  • Use repl docs to create a replication document that only replicates specific documents.

Note that only the modern replication API that operates on the replicator database is supported, there are no plans to support the previous replication API.

Alias

  • Use the alias commands to create, update and delete aliases for frequently used servers (and databases).
  • Use alias references with the cd command to connect to a server by alias.
  • Use alias references with the repl commands to replicate by alias.

Settings

  • Configure settings at runtime with the settings set command.
  • Save and load settings with the settings save and settings load commands.
  • Restore to default settings with the settings reset command.
  • Shortcut commands for frequently used settings.

Templates

  • Write document templates using perl, python, node and ruby or just write JSON if you prefer.
  • Test templates with the tpl parse command.
  • Modify and inspect template environment variables with the tpl set, tpl get, tpl clean and tpl print commands.
  • Generate a user template set from the system templates using tpl copy.
  • Configure the language used for template parsing with the templatelang setting.
  • Configure the default templates used with the tpl* settings.

Note that node is the recommended template parser as it enables writing design documents as Javascript functions rather than string literals.

Syntax Highlight

  • Switch between the default settings using the hilite and pygments commands.
  • Configure a different highlighter using the hilite and hiliteopts settings.
  • Use different style and language files for source-highlight with the shstyle and shlang settings.

Note that the default (and recommended) highlighter is source-highlight as it is significantly faster than pygmentize and easier to customize.

Bugs

Bug reports are welcome, please raise an issue if you encounter a bug.

Dependencies

Optional Dependencies

These dependencies are optional as rlx(1) works without them but some functionality will not work as expected.

  • vim for document creation and editing
  • perl, python, node or ruby for pretty printing JSON documents
  • less for displaying large documents
  • source highlight or pygmentize for highlighting JSON documents
  • w3m The default browser for launching HTML pages, configurable with the browser setting.

Database Version

  • Initially tested with couchdb 1.2.1 and subsequently migrated to using 1.3.0.

Languages

These are the language versions used for testing external JSON interpreters:

  • perl >= 5.16.3 with URI::Escape (run cpan URI::Escape to install)
  • python >= 2.7.3, untested with python 3.x.x
  • ruby >= 1.9.3 is required to enable JSON quirks mode so that primitive types are available for parsing and generation
  • node >= 0.8.21 but should work with any version of node
npm loves you