show commands Issue #63

This commit is contained in:
Peter Cottle 2013-03-09 20:26:29 -08:00
parent f49937c935
commit 092a92b0b4
7 changed files with 154 additions and 7 deletions

View file

@ -33,9 +33,9 @@ var instantCommands = [
});
}],
[/^show$/, function(bits) {
lines = [
var lines = [
intl.str('show-command'),
'<br/>',
'show commands',
'show solution',
'show goal'
@ -78,6 +78,20 @@ var instantCommands = [
throw new CommandResult({
msg: msg
});
}],
[/^show +commands$/, function(bits) {
var allCommands = getAllCommands();
var lines = [
intl.str('show-all-commands'),
'<br/>'
];
_.each(allCommands, function(regex, command) {
lines.push(command);
});
throw new CommandResult({
msg: lines.join('\n')
});
}]
];
@ -99,6 +113,24 @@ var regexMap = {
'undo': /^undo($|\s)/
};
var getAllCommands = function() {
var toDelete = [
'mobileAlert'
];
var allCommands = _.extend(
{},
require('../git/commands').regexMap,
require('../level').regexMap,
regexMap
);
_.each(toDelete, function(key) {
delete allCommands[key];
});
return allCommands;
};
exports.instantCommands = instantCommands;
exports.parse = util.genParseCommand(regexMap, 'processSandboxCommand');