Skip to content

Instantly share code, notes, and snippets.

@tsdtsdtsd
Last active August 29, 2015 14:19
Show Gist options
  • Save tsdtsdtsd/03a42f92047f68763b62 to your computer and use it in GitHub Desktop.
Save tsdtsdtsd/03a42f92047f68763b62 to your computer and use it in GitHub Desktop.
Starting peter - proof of concept
var prompt = require('prompt');
var config = require('config');
var peter = require('./peter.js');
if(!config.has('app.promptSchema') || !config.has('app.google') || !config.has('peter')) {
throw "Error: Check your config.";
}
prompt.start();
prompt.get(config.get('app.promptSchema'), function (err, result) {
if(!result || !result.query) {
console.log('Canceling...');
return;
}
var queryUrl = config.get('app.google.baseUrl') + encodeURIComponent(result.query);
console.log('########### Starting ###########');
new peter(config.get('peter')).run(queryUrl);
});
{
"app" : {
"google" : {
"baseUrl" : "https://www.google.com/search?q="
},
"promptSchema" : {
"properties": {
"query": {
"required": true
}
}
}
},
"peter" : {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment