obj gets list of files for a given container

@param {String} argv[2] url
@callback {bin~cb} callback
556828
function obj(argv, callback) {
  var uri = argv[2];

  if (argv[3]) {
    util.put(argv[2], '<> <> """' + argv[3] + '""" .', function(err, callback){
      if (err) {
        console.error(err);
      } else {
        console.log('put value : ' + argv[3]);
      }
    });
  } else {
    var wss = 'wss://' + uri.split('/')[2] + '/';

    var s = new ws(wss, {
      origin: 'http://websocket.org'
    });

    s.on('open', function open() {
      s.send('sub ' + uri);
    });

    s.on('close', function close() {
      console.log('disconnected');
    });

    s.on('message', function message(data, flags) {
      var a = data.split(' ');
      if (a.length && a[0] === 'pub') {
        util.getAll(a[1], function(err, res) {
          if (err) {
            callback(err);
          } else {
            callback(null, res[res.length-1].object.value);
          }
        });
      }
    });
  }
}
1013738
function loadModules(dir, container, args) {
  var files = fs.readdirSync(dir);
  for (var i = 0; i < files.length; i++) {
    var file = files[i];
    var filePath = path.join(dir, file);
    if (fs.statSync(filePath).isDirectory()) {
      container[file] = {};
      loadModules(filePath, container[file], args);
      continue;
    }
    if (/.+\.js$/.test(file)) {
      var name = file.replace(/\.js$/, '') 
      container[name] = require(filePath)(args, container);
    }
  }
}
251675
function extractFiles(args) {
  var usage = '\n' +
    cyan('USAGE:') + '   hulk [--wrapper wrapper] [--outputdir outputdir] ' +
    '[--namespace namespace] [--variable variable] FILES\n\n' +
    cyan('OPTIONS:') + ' [-w, --wrapper]   :: wraps the template (i.e. amd)\n' +
    '         [-o,  --outputdir] :: outputs the templates as individual files to a directory\n\n' +
    '         [-n,  --namespace] :: prepend string to template names\n\n' +
    '         [-vn, --variable]  :: variable name for non-amd wrapper\n\n' +
    cyan('EXAMPLE:') + ' hulk --wrapper amd ./templates/*.mustache\n\n' +
    cyan('NOTE:') + '    hulk supports the "*" wildcard and allows you to target specific extensions too\n';
  var files = [];

  if (options.version) {
    console.log(require('../package.json').version);
    process.exit(0);
  }

  if (!args.length || options.help) {
    console.log(usage);
    process.exit(0);
  }

  args.forEach(function(arg) {
    if (/\*/.test(arg)) {
      arg = arg.split('*');
      files = files.concat(
        fs.readdirSync(arg[0] || '.')
          .map(function(f) {
            var file = path.join(arg[0], f);
            return new RegExp(esc(arg[1]) + '$').test(f) && fs.statSync(file).isFile() && file;
          })
          .filter(function(f) {
            return f;
          })
      );
      return files;
    }

    if (fs.statSync(arg).isFile()) files.push(arg);
  });

  return files;
}
421817
function readFileSync (args) {
    var file = args.file;
    var next = args.next;

    if (isUnsupportedPath(file.url)) {
      // It's not a filesystem path, so let some other plugin handle it
      return next();
    }

    var filepath = getFileSystemPath(file.url);

    inferFileMetadata(file);
    return fs.readFileSync(filepath);
  }
613365
function(arg1) {
        if (arg1 == null) { return null; }
        var args = [name, 'root'].concat(grunt.util.toArray(arguments));
        return helpers.getFile.apply(helpers, args);
      }
1300860
function bin(argv) {
  // setup config
  var config = require('../config/config.js')

  program
  .option('-d, --database <database>', 'Database')
  .parse(argv)

  var defaultDatabase = 'media'

  config.database = program.database || config.database || defaultDatabase
  var url = process.argv[2] || 'https://www.reddit.com/r/perfectloops/top/?sort=top&t=all&count=25&after=t3_4j0v4f'

  solidbot.crawlImages(url, function(err, ret){
    if (err) {
      console.error(err)
    } else {
      for (var i = 0; i < ret.length; i++) {
        var image = ret[i]
        console.log(image)
        qpm_media.addMedia(image)
      }
    }
  })


}
1126409
def parsed_options_from_arguments(argv)
      options_to_merge = {}

      OptionParser.new do |opts|
        opts.banner = 'Usage: phare [options]'

        opts.on('--version', 'Display Phare’s version') do
          options_to_merge[:version] = true
        end

        opts.on('--directory x', 'The directory in which to run the checks (default is the current directory') do |directory|
          options_to_merge[:directory] = directory
        end

        opts.on('--skip x,y,z', 'Skip checks') do |checks|
          options_to_merge[:skip] = checks.split(',')
        end

        opts.on('--only x,y,z', 'Only run the specified checks') do |checks|
          options_to_merge[:only] = checks.split(',')
        end

        opts.on('--diff', 'Only run checks on modified files') do
          options_to_merge[:diff] = true
        end
      end.parse! argv

      options_to_merge
    end
592805
function put(argv, callback) {
  if (!argv[2]) {
    console.error("url is required");
    console.error("Usage : put <url> <data>");
    process.exit(-1);
  }
  if (!argv[3]) {
    console.error("data is required");
    console.error("Usage : put <url> <data>");
    process.exit(-1);
  }
  util.put(argv[2], argv[3], function(err, val, uri) {
    if (!err) {
      console.log('PUT to : ' + argv[2]);
    }
  });
}
330856
def add_container_output_args(argument_parser):
    
    argument_parser.add_argument("--output-directory", metavar="DIR", default="output.files",
        help="target directory for result files (default: './output.files')")
    argument_parser.add_argument("--result-files", metavar="PATTERN", action="append", default=[],
        help="pattern for specifying which result files should be copied to the output directory "
            "(default: '.')")
573489
function getArguments() {
  var port = 3000;
  var path = '.';
  var args = process.argv.slice(2);

  while (args.length) {
    var arg = args.shift();
    switch (arg) {
      case '-p':
        port = args.shift();
        break;
      default:
        path = arg || path;
    }
  }

  return {
    port: port,
    path: path
  };
}
782529
function parse(argv) {
  if (Array.isArray(argv)) {
    argv = argv.join(" ");
  }

  var opts = {};
  var paramStr = argv.replace(/(-{1,2}\S+?)\s+((?!-)[\S]+)/g, function(pair){
    var match = pair.match(/-{1,2}(\S+?)\s+((?!-)[\S]+)/);
    var key = match[1], value = match[2];
    try {
      value = JSON.parse(value);
    } catch (error) {}

    val(opts, key, value);
    return '';
  });

  var flags = {};
  var params = paramStr.split(' ').filter(function(param) {
    if (param == '') return false;
    if (param.search(/^-/) == 0) {
      param = param.replace(/^-{1,2}/, '');
      val(flags, param, true);
      return false;
    }
    return true;

  }).map(function(str) {
    try {
      return JSON.parse(str);
    } catch(error) {
      return str;
    }
  });

  return { opts: opts, params: params, flags: flags };
}
663859
function bin(argv) {
  // setup config
  var config = require('../config/config.js')

  program
  .option('-d, --database <database>', 'Database')
  .parse(argv)

  var defaultDatabase = 'media'

  config.database = program.database || config.database || defaultDatabase
  var url = process.argv[2] || 'https://www.reddit.com/r/perfectloops/top/?sort=top&t=all&count=25&after=t3_4j0v4f'


  qpm_media.getRandomUnseenFragment(null, config).then(function(ret){
    console.table(ret.ret[0])
    ret.conn.close()
  }).catch(function (err) {
    console.error(err)
  })


}
81706
function bin(argv) {
  ws(argv, function(err, res) {
    if (err) {
      console.err(err);
    } else {
      console.log(res);
    }
  });
}
615970
function getFiles(base, dir = '', results = []) {
            const files = fs.readdirSync(path.join(base, dir));
            for (const file of files) {
                const relativeToBase = path.join(dir, file);
                if (fs.statSync(path.join(base, relativeToBase)).isDirectory()) {
                    getFiles(base, relativeToBase, results);
                } else {
                    results.push(relativeToBase);
                }
            }
            return results;
        }
701848
function bin(argv) {
  rm(argv, function(err, res, uri) {
    console.log('rm of : ' + uri);
  });
}
35615
function getCommand(argv) {
  let command = argv._[0] || 'help';

  // Allow shorthand "-v" for version
  if (argv.v) {
    command = 'version';
  }

  // Allow shorthand "-h" for help
  if (argv.h) {
    command = 'help';
  }

  return command;
}
5994
function createDir (argv, next) {
  const loc = path.resolve(path.join(argv.d, argv.name))
  mkdirp(loc, function (err) {
    if (err) return next(err)
    process.chdir(loc)
    argv.directory = loc
    argv.d = loc
    next()
  })
}