node package manager


A simple and beautiful cli client for redis

pretty-redis is a cli client for redis, which is beautiful and very simple.

$ npm i -g pretty-redis

$ pretty-redis -h -p 6379
--help, -h  redis host name
--port, -p  redis port number
--auth, -a  redis auth key
--plugin  Node.js module name or file path

You can use pretty-redis as redis-cli in most cases:

 › keys *
 › set key value
 › get key

It will only prettify json format. If you want to prettify other language/type, you can specify the language/type by using --lang option:

 › get html --lang=html

It's already better then redis-cli but not pretty enough. So use highlight (alias: hl, hicat) filter to make it even better:

 › get html --lang=html | hl

The list of supported options and filters is available in wiki.

 › keys * --repl
 js › var fs = require('fs');
 js › // `data` - redis result
 js ›
 js › data =* do something */);
 js ›
 js › var content = JSON.stringify(data);
 js › fs.writeFileSync('./data.json', content);

The bare minimum for using pretty-redis on Node.js is requiring the module and create a PrettyRedis instance and calling #exec(command) to execute a command:

var PrettyRedis = require('pretty-redis');
var client = new PrettyRedis(); // connect to localhost:6379 
client.exec('keys *')
  .then(function (ctx) {
    // success 
  }, function (err) {
    // field 

pretty-redis provides several plugins.

var plugins = PrettyRedis.plugins;
// and so on 
client.use(function (next) {
  if (!this.hasFilter('your-filter')) {
    return next();
  // do something here 

(The MIT License)