mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-28 08:50:06 +02:00
WIP have half of hg commands mapped
This commit is contained in:
parent
51e1cc2b77
commit
a033173281
10 changed files with 817 additions and 27 deletions
|
@ -51,10 +51,47 @@ var Command = Backbone.Model.extend({
|
|||
this.set('warnings', []);
|
||||
},
|
||||
|
||||
replaceDotWithHead: function(string) {
|
||||
return string.replace(/\./g, 'HEAD');
|
||||
},
|
||||
|
||||
mapDotToHead: function() {
|
||||
var generalArgs = this.getGeneralArgs();
|
||||
var options = this.getSupportedMap();
|
||||
|
||||
generalArgs = _.map(generalArgs, function(arg) {
|
||||
return this.replaceDotWithHead(arg);
|
||||
}, this);
|
||||
var newMap = {};
|
||||
_.each(options, function(args, key) {
|
||||
newMap[key] = _.map(args, function(arg) {
|
||||
return this.replaceDotWithHead(arg);
|
||||
}, this);
|
||||
}, this);
|
||||
this.setGeneralArgs(generalArgs);
|
||||
this.setSupportedMap(newMap);
|
||||
},
|
||||
|
||||
deleteOptions: function(options) {
|
||||
var map = this.getSupportedMap();
|
||||
_.each(options, function(option) {
|
||||
delete map[option];
|
||||
}, this);
|
||||
this.setSupportedMap(map);
|
||||
},
|
||||
|
||||
getGeneralArgs: function() {
|
||||
return this.get('generalArgs');
|
||||
},
|
||||
|
||||
setGeneralArgs: function(args) {
|
||||
this.set('generalArgs', args);
|
||||
},
|
||||
|
||||
setSupportedMap: function(map) {
|
||||
this.set('supportedMap', map);
|
||||
},
|
||||
|
||||
getSupportedMap: function() {
|
||||
return this.get('supportedMap');
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue