nodejitsu/jitsu — pull request #288 by jesusabdullah (2012-07-27 02:07:16+00:00)
Title: [ux] After "get"ing a database, print help with example usage

When running `jitsu databases create ' and 'jitsu databases get ', jitsu will print help with examples on how to connect to the databases.

Redis:

```

josh@onix:~/dev/nodejitsu/jitsu$ jitsu databases create r testRedis
info: Welcome to Nodejitsu jesusabdullah
info: It worked if it ends with Nodejitsu ok
info: Executing command databases create r testRedis
info: A new redis has been created
data: Database Type: redis
data: Database Name: testRedis
data: Connection host: chubb.redistogo.com
data: Connection port: 9723
data: Connection auth: f99172175be19664fdd1970acb6c5fab
help:
help: Connect with the `redis-cli` cli tool:
help:
help: $ redis-cli -h chubb.redistogo.com -p 9723 -a f99172175be19664fdd1970acb6c5fab
help:
help: Connect with the `redis` module:
help:
help: var redis = require('redis');
help: var client = redis.createClient('chubb.redistogo.com', 9723);
help: client.auth('f99172175be19664fdd1970acb6c5fab', function (err) {
help: if (err) { throw err; }
help: // You are now connected to your redis.
help: });
help:
info: Nodejitsu ok
josh@onix:~/dev/nodejitsu/jitsu$
```

Mongo:
```

josh@onix:~/dev/nodejitsu/jitsu$ jitsu databases get testMongo
info: Welcome to Nodejitsu jesusabdullah
info: It worked if it ends with Nodejitsu ok
info: Executing command databases get testMongo
data: Database Type: mongo
data: Database Name: testMongo
data: Connection url: mongodb://nodejitsu:b94f0f3d4dc07b816a31521b672e23c3@staff.mongohq.com:10027/nodejitsudb42205449082
help:
help: Connect with the `mongo` cli client:
help:
help: $ mongo staff.mongohq.com:10027/nodejitsudb42205449082 -u nodejitsu -p b94f0f3d4dc07b816a31521b672e23c3
help:
help: Connect with the `mongodb-native module`:
help:
help: var mongodb = require('mongodb');
help: var db = new mongodb.Db('nodejitsudb42205449082',
help: new mongodb.Server('staff.mongohq.com', 10027, {})
help: );
help: db.open(function (err, db_p) {
help: if (err) { throw err; }
help: db.authenticate('nodejitsu', 'b94f0f3d4dc07b816a31521b672e23c3', function (err, replies) {
help: // You are now connected and authenticated.
help: });
help: });
help:
help: Connect with the `mongoose` module:
help:
help: var mongoose = require('mongoose');
help: mongoose.connect('mongodb://nodejitsu:b94f0f3d4dc07b816a31521b672e23c3@staff.mongohq.com:10027/nodejitsudb42205449082');
help:
info: Nodejitsu ok
```

Couch:
```
josh@onix:~/dev/nodejitsu/jitsu$ jitsu databases get testCouch
info: Welcome to Nodejitsu jesusabdullah
info: It worked if it ends with Nodejitsu ok
info: Executing command databases get testCouch
data: Database Type: couch
data: Database Name: testCouch
data: Connection url: http://nodejitsudb944957670256.iriscouch.com:5984
data: SSL connection url: https://nodejitsudb944957670256.iriscouch.com:6984
help:
help: Connect with `curl`:
help:
help: $ curl http://nodejitsudb944957670256.iriscouch.com:5984
help:
help: Connect with the `futon` web app (open in your browser):
help:
help: http://nodejitsudb944957670256.iriscouch.com:5984/_utils
help:
help: Connect with the `nano` module:
help:
help: var nano = require('nano')('http://nodejitsudb944957670256.iriscouch.com:5984');
help:
info: Nodejitsu ok
josh@onix:~/dev/nodejitsu/jitsu$
```