bin/query.js
function runTool(platform, args, done) {
  if (args.length < 1) {
    console.log('usage: query.js file.wtf-trace "[query string]"');
    done(1);
    return;
  }

  var inputFile = args[0];
  var exprArgs = args.slice(1);
  var expr = exprArgs.join(' ').trim();

  console.log('Querying ' + inputFile + '...');

  // Create database for querying.
  var loadStart = wtf.now();
  wtf.db.load(inputFile, function(db) {
    if (db instanceof Error) {
      console.log('ERROR: unable to open ' + inputFile, db);
      done(1);
      return;
    }

    var loadDuration = wtf.now() - loadStart;
    console.log('Database loaded in ' + loadDuration.toFixed(3) + 'ms');
    console.log('');

    queryDatabase(db, expr);

    done(0);
  });
}
function runTool(platform, args, done) {
  if (args.length < 1) {
    console.log('usage: query.js file.wtf-trace "[query string]"');
    done(1);
    return;
  }

  var inputFile = args[0];
  var exprArgs = args.slice(1);
  var expr = exprArgs.join(' ').trim();

  console.log('Querying ' + inputFile + '...');

  // Create database for querying.
  var loadStart = wtf.now();
  wtf.db.load(inputFile, function(db) {
    if (db instanceof Error) {
      console.log('ERROR: unable to open ' + inputFile, db);
      done(1);
      return;
    }

    var loadDuration = wtf.now() - loadStart;
    console.log('Database loaded in ' + loadDuration.toFixed(3) + 'ms');
    console.log('');

    queryDatabase(db, expr);

    done(0);
  });
}
function runTool ( platform , args , done ) { if ( args . length < 1 ) { console . log ( 'usage: query.js file.wtf-trace "[query string]"' ) ; done ( 1 ) ; return ; } var inputFile = args [ 0 ] ; var exprArgs = args . slice ( 1 ) ; var expr = exprArgs . join ( ' ' ) . trim ( ) ; console . log ( 'Querying ' + inputFile + '...' ) ; // Create database for querying. var loadStart = wtf . now ( ) ; wtf . db . load ( inputFile , function ( db ) { if ( db instanceof Error ) { console . log ( 'ERROR: unable to open ' + inputFile , db ) ; done ( 1 ) ; return ; } var loadDuration = wtf . now ( ) - loadStart ; console . log ( 'Database loaded in ' + loadDuration . toFixed ( 3 ) + 'ms' ) ; console . log ( '' ) ; queryDatabase ( db , expr ) ; done ( 0 ) ; } ) ; }
Query tool.
@param {!wtf.pal.IPlatform} platform Platform abstraction layer.
@param {!Array.<string>} args Command line arguments.
@param {function(number)} done Call to end the program with a return code.
Query tool .