<commit_before>
var npm = require("../npm")
  , sys = require("sys")

module.exports = help
help.printer = sys.puts

function help (args, conf, cb) {
  var command = args.shift()
  if (!(command in npm.commands)) {
    help.usage(help.printer)
  }
  if ("help" in npm.commands[command]) npm.commands[command].help(help.printer)
  else sys.puts(
    "No help provided for "+command+".  Maybe try 'man npm'")
  cb()
}

help.help = function (p) {
  p("npm help <command>")
  p("Learn more about <command>")
  p("Available commands: ")
  Object.keys(npm.commands).forEach(function (c) {
    p("  "+c)
  })
}

help.usage = function (p) {
  p("")
  p("Usage: ")
  p("  " + path.basename(process.argv[1])
    + " [global options] <command> [command options]")
  p("")
  p("<command>          Method to call on the npm object.")
  p("                   Supported: "+Object.keys(npm.commands))
  p("[command options]  The arguments to pass to the function.");
}<commit_msg>A better help command, which uses man<commit_after>
var npm = require("../npm")
  , sys = require("sys")
  , fs = require("fs")
  , path = require("path")
  , exec = require("./utils/exec")

// If unknown, the command is "help"
// then shell to man

module.exports = help

function help (args, conf, cb) {
  var command = args.shift()
  fs.stat(path.join(__dirname, "../man/"+command+".1"), function (e, o) {
    if (e) command = "help"
    // TODO: Figure out how to do this so that the user can still page it
    exec("man", [path.join(__dirname, "../man/"+command+".1")], cb)
  })
}
{'fraction_non_alphanumeric': 0.18592640413169786, 'fraction_numerical': 0.001936733376371853, 'mean_word_length': 3.200542005420054, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '166856', 'n_tokens_mistral': 541, 'n_tokens_neox': 526, 'n_words': 155}