<commit_before>var thunkify = require('thunkify');
var which = require('which');
var child_process = require('child_process');


var sh = Proxy.create({
  get: function(receiver, value) {

    // use a command-line args parser
    value = value.split(' ');
    var cmd = value[0];
    var args = value.splice(1, value.length);

    return thunkify(function _cmd(cb){
      which(cmd, function(err, path){
        if (err || !path) {
          return cb(err);
        }

        return cb(null, child_process.spawn(cmd, args));
      });
    })
  }
});



module.exports = sh;<commit_msg>more comments<commit_after>var thunkify = require('thunkify');
var which = require('which');
var child_process = require('child_process');


var sh = Proxy.create({
  get: function(receiver, value) {

    //TODO: use a command-line args parser
    value = value.split(' ');

    // the command
    var cmd = value[0];

    // and its arguments/options
    var args = value.splice(1, value.length);

    return thunkify(function _cmd(cb){
      which(cmd, function(err, path){
        if (err || !path) {
          return cb(err);
        }

        return cb(null, child_process.spawn(cmd, args));
      });
    })
  }
});



module.exports = sh;
{'fraction_non_alphanumeric': 0.15247364152473641, 'fraction_numerical': 0.0032441200324412004, 'mean_word_length': 2.716867469879518, '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': '269737', 'n_tokens_mistral': 408, 'n_tokens_neox': 392, 'n_words': 98}