Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

  • Loading branch information...
commit 9bd7f1e48b3658a2af8854a5cf8c3535156abba8 1 parent d9aabc6
@DamonOehlman authored
Showing with 13 additions and 2 deletions.
  1. +13 −2 lib/couchtty.js
View
15 lib/couchtty.js
@@ -11,9 +11,15 @@ var cleave = require('cleave'),
use: function(name) {
db = couch.use(name);
+
+ return _nanoWrap(db.info, db);
},
list: function() {
+ if (! db) {
+ return _error('No db specified, run "use %dbname%" to select a db');
+ }
+
return _nanoWrap(db.list, db);
},
@@ -24,16 +30,21 @@ var cleave = require('cleave'),
// ## private functions
+function _error(text) {
+ out('!{2718,bold} !{red}' + text);
+ return false;
+}
+
function _nanoWrap(targetCall, instance) {
var args = Array.prototype.slice.call(arguments, 2);
return function(callback) {
function handleResponse(err, res, headers) {
if (err) {
- out('!{red}' + err.toString());
+ out('!{2718,bold} !{red}' + err.toString());
}
else {
- out('!{check,green} !{}' + JSON.stringify(res));
+ out('!{check,green} !{grey}' + JSON.stringify(res));
}
callback();
Please sign in to comment.
Something went wrong with that request. Please try again.