#!/usr/bin/env node
'use strict';

var npmMan = require('./');

var help = require('help-version')(usage()).help,
    minimist = require('minimist'),
    manPager = require('man-pager'),
    defaultPager = require('default-pager');


function usage() {
  return 'Usage:  npm-man [--no-man] <package>';
}


var opts = minimist(process.argv.slice(2), {
  boolean: 'man',
  default: {
    man: true
  },
  unknown: function (arg) {
    if (arg[0] == '-') {
      return help(1);
    }
  }
});


(function (opts, argv) {
  if (argv.length != 1) {
    return help(argv.length);
  }

  npmMan(argv[0], opts, function (err, man) {
    if (err) return console.error(err);
    manPager().end(man);
  });
}(opts, opts._));

@@ -571,16 +571,67 @@
 );%0A  %7D%0A%0A
+  var pager = opts.man ? manPager : defaultPager;%0A%0A
   npmMan
@@ -708,28 +708,25 @@
 r(err);%0A    
-manP
+p
 ager().end(m

Use default pager for Markdown