Last active
August 29, 2015 14:19
-
-
Save tsdtsdtsd/03a42f92047f68763b62 to your computer and use it in GitHub Desktop.
Starting peter - proof of concept
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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