Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Message refinements, provide info on db when on `use` command

  • Loading branch information...
commit 9bd7f1e48b3658a2af8854a5cf8c3535156abba8 1 parent d9aabc6
Damon Oehlman authored

Showing 1 changed file with 13 additions and 2 deletions. Show diff stats Hide diff stats

  1. +13 2 lib/couchtty.js
15 lib/couchtty.js
@@ -11,9 +11,15 @@ var cleave = require('cleave'),
11 11
12 12 use: function(name) {
13 13 db = couch.use(name);
  14 +
  15 + return _nanoWrap(db.info, db);
14 16 },
15 17
16 18 list: function() {
  19 + if (! db) {
  20 + return _error('No db specified, run "use %dbname%" to select a db');
  21 + }
  22 +
17 23 return _nanoWrap(db.list, db);
18 24 },
19 25
@@ -24,16 +30,21 @@ var cleave = require('cleave'),
24 30
25 31 // ## private functions
26 32
  33 +function _error(text) {
  34 + out('!{2718,bold} !{red}' + text);
  35 + return false;
  36 +}
  37 +
27 38 function _nanoWrap(targetCall, instance) {
28 39 var args = Array.prototype.slice.call(arguments, 2);
29 40
30 41 return function(callback) {
31 42 function handleResponse(err, res, headers) {
32 43 if (err) {
33   - out('!{red}' + err.toString());
  44 + out('!{2718,bold} !{red}' + err.toString());
34 45 }
35 46 else {
36   - out('!{check,green} !{}' + JSON.stringify(res));
  47 + out('!{check,green} !{grey}' + JSON.stringify(res));
37 48 }
38 49
39 50 callback();

0 comments on commit 9bd7f1e

Please sign in to comment.
Something went wrong with that request. Please try again.