<commit_before>//Import dependencies
var colors = require('colors');

//Import libs
var Commands = require('./commands.js');
var Display = require('./display.js');

//Import config
var config = require('../config.js');

//Help class
var Help =
{
  //Main help function
  Main: function(arguments)
  {
    //Check the arguments
    if(typeof arguments === 'undefined'){ var arguments = []; }

    //Check the arguments length
    if(arguments.length === 0)
    {
      //Show the default help
      return Help.Global();
    }

    //Show the specific documentation
    return Help.Specific(arguments[0]);
  },

  //Global help
  Global: function()
  {
    //Display a line break
    console.log('');

    //Show the package info
    console.log(config.name + ' v' + config.version);

    //Check the package description
    if(config.description !== ''){ console.log(config.description); }

    //Get the list with all the commands
    var keys = Object.keys(Commands.list);

    //Check the commands length
    if(keys.length > 0)
    {
      //Display a line break
      console.log('');

      //Commands available
      console.log('Commands available:');

      //Read all the commands
      for(var i = 0; i < keys.length; i++)
      {
        //Get the command object
        var obj = Commands.list[keys[i]];

        //Get the space
        var space = '';

        //Add the spaces
        for(var k = obj.command.length; k < 18; k++){ space = space + ' '; }

        //Show the command info
        console.log('  ' + obj.command + space + obj.description);
      }
    }

    //Display an empty line
    console.log('');

    //Show help
    console.log('Run "' + config.name + ' help <command>" to get more information about a command.');

    //display an empty line
    console.log('');
  },

  //Display the help specific
  Specific: function(command)
  {
    //Find the command on the list
    if(typeof Commands.list[command] === 'undefined'){ return Display.error('Unknow command "' + command + '"'); }

    //Get the command object
    var obj = Commands.list[command];

    //Check the usage
    if(typeof obj.usage !== 'undefined' && typeof obj.description !== 'undefined')
    {
      //Display a line break
      console.log('');

      //Check the usage
      if(typeof obj.usage !== 'undefined'){ console.log('Usage:        ' + obj.usage); }

      //Check the command description
      if(typeof obj.description !== 'undefined'){ console.log('Description:  ' + obj.description); }
    }

    //Check for options
    if(obj.options.length > 0)
    {
      //Display a line break
      console.log('');

      //Display the options
      console.log('Options: ');

      //Read the full options list
      for(var i = 0; i < obj.options.length; i++)
      {
        //Get the option
        var opt = obj.options[i];

        //Get the space<commit_msg>lib/help.js: get commands list from nutty config<commit_after>//Import dependencies
var colors = require('colors');

//Import libs
var Display = require('./display.js');

//Import config
var config = require('../config.js');

//Help class
var Help =
{
  //Main help function
  Main: function(arguments)
  {
    //Check the arguments
    if(typeof arguments === 'undefined'){ var arguments = []; }

    //Check the arguments length
    if(arguments.length === 0)
    {
      //Show the default help
      return Help.Global();
    }

    //Show the specific documentation
    return Help.Specific(arguments[0]);
  },

  //Global help
  Global: function()
  {
    //Display a line break
    console.log('');

    //Show the package info
    console.log(config.name + ' v' + config.version);

    //Check the package description
    if(config.description !== ''){ console.log(config.description); }

    //Get the list with all the commands
    var keys = Object.keys(config.commands);

    //Check the commands length
    if(keys.length > 0)
    {
      //Display a line break
      console.log('');

      //Commands available
      console.log('Commands available:');

      //Read all the commands
      for(var i = 0; i < keys.length; i++)
      {
        //Get the command object
        var obj = config.commands[keys[i]];

        //Get the space
        var space = '';

        //Add the spaces
        for(var k = obj.command.length; k < 18; k++){ space = space + ' '; }

        //Show the command info
        console.log('  ' + obj.command + space + obj.description);
      }
    }

    //Display an empty line
    console.log('');

    //Show help
    console.log('Run "' + config.name + ' help <command>" to get more information about a command.');

    //display an empty line
    console.log('');
  },

  //Display the help specific
  Specific: function(command)
  {
    //Find the command on the list
    if(typeof config.commands[command] === 'undefined'){ return Display.error('Unknow command "' + command + '"'); }

    //Get the command object
    var obj = config.commands[command];

    //Check the usage
    if(typeof obj.usage !== 'undefined' && typeof obj.description !== 'undefined')
    {
      //Display a line break
      console.log('');

      //Check the usage
      if(typeof obj.usage !== 'undefined'){ console.log('Usage:        ' + obj.usage); }

      //Check the command description
      if(typeof obj.description !== 'undefined'){ console.log('Description:  ' + obj.description); }
    }

    //Check for options
    if(obj.options.length > 0)
    {
      //Display a line break
      console.log('');

      //Display the options
      console.log('Options: ');

      //Read the full options list
      for(var i = 0; i < obj.options.length; i++)
      {
        //Get the option
        var opt = obj.options[i];

        //Get the space
{'fraction_non_alphanumeric': 0.1455366446682876, 'fraction_numerical': 0.0027787426189649182, 'mean_word_length': 2.2137276785714284, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '7264869', 'n_tokens_mistral': 1673, 'n_tokens_neox': 1613, 'n_words': 512}