mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-26 07:58:34 +02:00
more progress
This commit is contained in:
parent
5e2bace639
commit
01fb9ec25b
3 changed files with 47 additions and 32 deletions
|
@ -1,3 +1,5 @@
|
|||
var _ = require('underscore');
|
||||
|
||||
var getRegexMap = function() {
|
||||
return {
|
||||
// ($|\s) means that we either have to end the string
|
||||
|
@ -27,5 +29,15 @@ var getShortcutMap = function() {
|
|||
};
|
||||
};
|
||||
|
||||
var expandShortcut = function(commandStr) {
|
||||
_.each(getShortcutMap(), function(regex, method) {
|
||||
var results = regex.exec(commandStr);
|
||||
if (results) {
|
||||
commandStr = method + ' ' + commandStr.slice(results[0].length);
|
||||
}
|
||||
});
|
||||
return commandStr;
|
||||
};
|
||||
|
||||
exports.getRegexMap = getRegexMap;
|
||||
exports.getShortcutMap = getShortcutMap;
|
||||
exports.expandShortcut = expandShortcut;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue