mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-20 21:35:42 +02:00
Try to do --no-prompts
This commit is contained in:
parent
17c6fff6c0
commit
1e887f3775
3 changed files with 23 additions and 8 deletions
|
@ -81,8 +81,9 @@ var LevelBuilder = Level.extend({
|
|||
initGoalData: function() {
|
||||
// add some default behavior in the beginning if we are not editing
|
||||
if (!this.options.editLevel) {
|
||||
this.level.goalTreeString = '{"branches":{"main":{"target":"C1","id":"main"},"makeLevel":{"target":"C2","id":"makeLevel"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true},"C1":{"parents":["C0"],"id":"C1"},"C2":{"parents":["C1"],"id":"C2"}},"HEAD":{"target":"makeLevel","id":"HEAD"}}';
|
||||
this.level.solutionCommand = 'git checkout -b makeLevel; git commit';
|
||||
// Trivial tree: single C0 commit, HEAD=main
|
||||
this.level.goalTreeString = '{"branches":{"main":{"target":"C0","id":"main"}},"commits":{"C0":{"parents":[],"id":"C0","rootCommit":true}},"HEAD":{"target":"main","id":"HEAD"}}';
|
||||
this.level.solutionCommand = '';
|
||||
}
|
||||
LevelBuilder.__super__.initGoalData.apply(this, arguments);
|
||||
},
|
||||
|
@ -292,13 +293,25 @@ var LevelBuilder = Level.extend({
|
|||
return;
|
||||
}
|
||||
|
||||
while (!this.level.name) {
|
||||
this.defineName();
|
||||
}
|
||||
|
||||
var mainDeferred = Q.defer();
|
||||
var chain = mainDeferred.promise;
|
||||
|
||||
// If noPrompts is set, skip hint/startDialog prompts
|
||||
if (this.options.noPrompts) {
|
||||
if (this.level.hint === undefined) {
|
||||
this.level.hint = {'en_US': ''};
|
||||
}
|
||||
if (this.startDialogObj === undefined) {
|
||||
this.startDialogObj = null;
|
||||
}
|
||||
new MarkdownPresenter({
|
||||
fillerText: JSON.stringify(this.getExportObj(), null, 2),
|
||||
previewText: intl.str('share-json')
|
||||
});
|
||||
command.finishWith(deferred);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.level.hint === undefined) {
|
||||
var askForHintDeferred = Q.defer();
|
||||
chain = chain.then(function() {
|
||||
|
|
|
@ -184,7 +184,7 @@ var regexMap = {
|
|||
'level': /^level\s?([a-zA-Z0-9]*)/,
|
||||
'levels': /^levels($|\s)/,
|
||||
'mobileAlert': /^mobile alert($|\s)/,
|
||||
'build level': /^build +level\s?([a-zA-Z0-9]*)( +--skipIntro)?$/,
|
||||
'build level': /^build +level\s?([a-zA-Z0-9]*)( +--skipIntro)?( +--noPrompts)?$/,
|
||||
'export tree': /^export +tree$/,
|
||||
'importTreeNow': /^importTreeNow($|\s)/,
|
||||
'importLevelNow': /^importLevelNow($|\s)/,
|
||||
|
|
|
@ -208,10 +208,12 @@ var Sandbox = Backbone.View.extend({
|
|||
|
||||
var regexResults = command.get('regexResults') || [];
|
||||
var toEdit = regexResults[1] || false;
|
||||
const rawStr = command.attributes.rawStr;
|
||||
this.levelBuilder = new LevelBuilder({
|
||||
deferred: whenBuilderOpen,
|
||||
editLevel: toEdit,
|
||||
skipIntro: command.attributes.rawStr.indexOf('skipIntro') !== -1,
|
||||
skipIntro: rawStr.indexOf('skipIntro') !== -1,
|
||||
noPrompts: rawStr.indexOf('noPrompts') !== -1,
|
||||
});
|
||||
whenBuilderOpen.promise.then(function() {
|
||||
command.finishWith(deferred);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue