2015-10-05 21:33:57 +00:00
|
|
|
/// <reference path="typings/tsd.d.ts" />
|
|
|
|
var smartcli = require("./index.js");
|
2015-10-06 23:07:38 +00:00
|
|
|
var bl = require("beautylog");
|
|
|
|
|
|
|
|
bl.log('now starting Test');
|
|
|
|
bl.log('starting with initial CLI commands and options');
|
|
|
|
|
|
|
|
var commandsString:string = 'You specified the following commands:';
|
|
|
|
var commands = smartcli.getCommands();
|
|
|
|
for (var key in commands) {
|
|
|
|
commandsString = commandsString + ' ' + commands[key];
|
|
|
|
}
|
|
|
|
bl.log(commandsString);
|
|
|
|
|
2015-10-14 18:59:01 +00:00
|
|
|
|
|
|
|
var getCwdTest = function(){
|
|
|
|
console.log('The current directory is: ' + smartcli.getCwd().path);
|
|
|
|
};
|
|
|
|
|
|
|
|
var checkCommandTest = function() {
|
|
|
|
if (smartcli.checkCommand('jazz')) {
|
|
|
|
bl.log('One of your commands is jazz');
|
|
|
|
} else {
|
|
|
|
bl.log('None of your commands is jazz');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
var getOptionTest = function() {
|
|
|
|
console.log('We now test for option --test')
|
|
|
|
console.log(smartcli.getOption('test'));
|
2015-10-06 23:07:38 +00:00
|
|
|
}
|
|
|
|
|
2015-10-14 18:59:01 +00:00
|
|
|
var checkOptionTest = function() {
|
|
|
|
|
|
|
|
};
|
2015-10-05 21:33:57 +00:00
|
|
|
|
|
|
|
var getAnswerTest = function() {
|
|
|
|
smartcli.getAnswer('How do you feel?',function(answer){
|
|
|
|
console.log('The answer is: ' + answer);
|
|
|
|
getChoiceTest();
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
var getChoiceTest = function() {
|
2015-10-05 22:45:52 +00:00
|
|
|
smartcli.getChoice('What music do you like to hear?',['Jazz','Blues','Classical'],function(answer){
|
2015-10-05 21:33:57 +00:00
|
|
|
console.log('The answer is: ' + answer);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-10-14 18:59:01 +00:00
|
|
|
|
|
|
|
//starting command tests
|
|
|
|
getCwdTest();
|
|
|
|
checkCommandTest();
|
|
|
|
getOptionTest();
|
|
|
|
|
|
|
|
//starting first interaction test (the other tests are then started via callbacks)
|
2015-10-05 21:33:57 +00:00
|
|
|
getAnswerTest();
|