<commit_before>var fs = require('fs');
var _ = require('lodash');

var whimp = require('../whimper');
var logger = require('../logger');

// create-dir()
whimp.task('create-dir', {
  run: function createDir(params, resolver) {
    // Contrived to show "async"
    setTimeout(function() {
      fs.mkdir(params.dir, function(e) {
        if ( e != null ) {
          resolver.reject(e);
        }
        else {
          resolver.resolve();
        }
      });
    }, 1005);
  }
}); //- create-dir()

// delete-dir()
whimp.task('delete-dir', {
  depends: [ 'create-dir' ],
  run: function deleteDir(params, resolver) {
    fs.rmdir(params.dir, function(e) {
      if ( e != null ) {
        resolver.reject(e);
      }
      else {
        resolver.resolve();
      }
    });
  }
}); //- delete-dir()

// cddir()
whimp.task('cddir', {
  options: {
    '!dir': 'The directory to create and then delete.'
  },
  depends: [ 'delete-dir' ]
}); //- cddir()

whimp.cli();

// $ node complex cddr --dir test<commit_msg>Update examples.<commit_after>var fs = require('fs');
var _ = require('lodash');

var whimp = require('../whimper');
var logger = require('../logger');

// create-dir()
whimp.task('create-dir', {
  run: function createDir(params, resolver) {
    // Contrived to show "async"
    setTimeout(function() {
      fs.mkdir(params.dir, function(e) {
        if ( e != null ) {
          resolver.reject(e);
        }
        else {
          resolver.resolve();
        }
      });
    }, 1005);
  }
}); //- create-dir()

// delete-dir()
whimp.task('delete-dir', {
  depends: [ 'create-dir' ],
  run: function deleteDir(params, resolver) {
    fs.rmdir(params.dir, function(e) {
      if ( e != null ) {
        resolver.reject(e);
      }
      else {
        resolver.resolve();
      }
    });
  }
}); //- delete-dir()

// cddir()
whimp.task('cddir', {
  options: {
    '!dir': 'The directory to create and then delete.'
  },
  depends: [ 'delete-dir' ]
}); //- cddir()

whimp.cli();

// $ node complex cddir --dir test
{'fraction_non_alphanumeric': 0.1997041420118343, 'fraction_numerical': 0.0039447731755424065, 'mean_word_length': 2.195275590551181, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5068151', 'n_tokens_mistral': 714, 'n_tokens_neox': 711, 'n_words': 138}