Code Monkey home page Code Monkey logo

reql-cli's Introduction

ReQL CLI

We wanted to be able to query our RethinkDB cluster from the command line and we realised there wasn't an obvious way to do this whilst continuing to use the Javascript API.

This is the result of this desire + a hack day and messing about with some aspects of ES6 at the same time.

We would welcome other contributors to this project.

Installation

To install the most stable reql-cli binary globally on your system via npm you can simply:

$ [sudo] npm install -g reql-cli
$ reql-cli --help

Circle CI

NPM

Note: you will need node and npm installed first.

The easiest way to install node.js is with nave.sh by executing [sudo] ./nave.sh usemain stable

Notes

We decided not to use the Node.js REPL in favour of a very basic custom implementation - therefore currently some common convenience keystrokes do not currently work.

Usage

./bin/reql-cli -h [host] -p [port] -db [database]

  Options:
    -h  : host     [default:localhost]
    -p  : port     [default:28015]
    -db : database [default:test]
$ ./bin/reql-cli
- RethinkDB Command Line Interface v1.0.0
- Courtesy of Workshape.io
reql-cli> help
[-] Available commands:
  - dbs - print available databases
  - db {db} - change current db to {db}
  - tables - print available tables in current db
  - r... - any rethink valid query, omitting run()

  - press ctrl + c to quit
reql-cli> dbs
[-] Available databases on localhost:
  - rethinkdb
  - test
  - fisher

reql-cli> db fisher
[.] Changed default database to fisher

reql-cli> r.table('account').orderBy(r.desc('created')).limit(3)
[
  { created: Wed Mar 18 2015 11:42:38 GMT+0000 (UTC),
    email: '[email protected]',
    hash: '$2a$10$vZxOl3gS/eNmovcYzn5HaOGa4cfsfJngMCQPgvTdmU5RSLeegN94u',
    id: '95ab2b32-1673-439f-9c42-a312890f67a5',
    verificationKey: '0b1f-154d-2227',
    verified: true
  },
  { created: Wed Mar 18 2015 11:38:52 GMT+0000 (UTC),
    email: '[email protected]',
    hash: '$2a$04$Ab6zeo6vXhaUAb/LEsfn4e5FCvKMQDdjdpU4RpYiFmoetTBgjXdGS',
    id: '1014e711-96f8-43d1-9068-a08bfffac140',
    verified: true
  },
  { created: Wed Mar 18 2015 11:38:52 GMT+0000 (UTC),
    email: '[email protected]',
    hash: '$2a$04$Ab6zeo6vXhaUAb/LEsfn4e5FCvKMQDdjdpU4RpYiFmoetTBgjXdGS',
    id: '2e0a1009-09e6-49c4-a540-7c79d2229608',
    verified: true
  }
]
[.] Took: 0.024 seconds
[.] No Results: 1

reql-cli>

Tests

npm test

reql-cli's People

Contributors

gordyd avatar missinglink avatar scull7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

reql-cli's Issues

Support for RethinkDB 2.X

RethinkDB dependency should be upgraded to 2.x so that the CLI can connect to the latest version of RethinkDB.

Connection with security

Hi!, i have this inssue:

ReqlAuthError: Could not connect to localhost:28015, incorrect authentication key.
How i can conn my Rethinkdb?

Problem Using pipes

Hi First, thanks for this tool!
i'm trying to send files with reql queries to it but i have this error:

- RethinkDB Command Line Interface v1.0.7
- Courtesy of Workshape.io
reql-cli> /home/malaniz/.nvm/versions/node/v8.3.0/lib/node_modules/reql-cli/lib/repl.js:177
      process.stdin.setRawMode(true);
                    ^

TypeError: process.stdin.setRawMode is not a function
    at REPL.start (/home/malaniz/.nvm/versions/node/v8.3.0/lib/node_modules/reql-cli/lib/repl.js:177:21)
    at Object.<anonymous> (/home/malaniz/.nvm/versions/node/v8.3.0/lib/node_modules/reql-cli/lib/index.js:29:6)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Module.require (module.js:517:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/malaniz/.nvm/versions/node/v8.3.0/lib/node_modules/reql-cli/bin/reql-cli:3:1)
    at Module._compile (module.js:573:30)
    at Object.Module._extensions..js (module.js:584:10)
    at Module.load (module.js:507:32)
    at tryModuleLoad (module.js:470:12)
    at Function.Module._load (module.js:462:3)
    at Function.Module.runMain (module.js:609:10)
    at startup (bootstrap_node.js:158:16)
    at bootstrap_node.js:578:3

Can you help or guide me to fix it?
thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.