#!/usr/bin/env node

'use strict';

const yargs = require('yargs');
const chalk = require('chalk');
const Helper = require('./Helper');
const formats = require('./formats');

const helperInstance = new Helper();

const argv = yargs
  .usage('organize <command>')
  .command('it', 'Organizes current directory', (yargs) => {

    let fileNames = helperInstance.getFileNames(process.cwd());

    console.log(chalk.green('Scanning'));

    for (let i = 0; i < fileNames.length; i++) {

      let fileExtension = helperInstance.getExtension(fileNames[i]).toUpperCase();

      for (let type in formats) {

        if (formats.hasOwnProperty(type) && formats[type].indexOf(fileExtension) >= 0) {

          helperInstance.organize(process.cwd(), fileNames[i], type);

        }
      }
    }

    console.log(chalk.green('Done!'));
  })
  .help('h')
  .alias('h', 'help')
  .argv;

#!/usr/bin/env node

'use strict';

const yargs = require('yargs');
const chalk = require('chalk');
const Helper = require('./Helper');
const formats = require('./formats');

const helperInstance = new Helper();

const argv = yargs
  .usage('organize <command>')
  .command('files', 'Organizes current directory', (yargs) => {

    let fileNames = helperInstance.getFileNames(process.cwd());

    console.log(chalk.green('Scanning'));

    for (let i = 0; i < fileNames.length; i++) {

      let fileExtension = helperInstance.getExtension(fileNames[i]).toUpperCase();

      for (let type in formats) {

        if (formats.hasOwnProperty(type) && formats[type].indexOf(fileExtension) >= 0) {

          helperInstance.organize(process.cwd(), fileNames[i], type);

        }
      }
    }

    console.log(chalk.green('Done!'));
  })
  .help('h')
  .alias('h', 'help')
  .argv;

Update command from 'organize it' to 'organize files'
Update: Update command from 'organize it' to 'organize files'
