From b7910411bdeda0c65f91f98c50f9d56223f1a09a Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 6 Dec 2016 09:51:04 +0100 Subject: [PATCH] main: add -b / --blank cli option to start with a blank session --- app/main/callbacks.js | 11 +++++++++-- app/main/settings.js | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/main/callbacks.js b/app/main/callbacks.js index cbfc672e..277a2057 100644 --- a/app/main/callbacks.js +++ b/app/main/callbacks.js @@ -11,8 +11,15 @@ module.exports = { ipc.send('connected') if (settings.read('theme')) ipc.send('applyStyle',settings.read('theme'),clientId) - if (settings.read('sessionFile')) this.sessionOpen({path:settings.read('sessionFile')},clientId) - var recentSessions = settings.read('recentSessions') + + if (settings.read('newSession')) { + ipc.send('sessionNew') + return + } + + if (settings.read('sessionFile')) this.sessionOpen({path:settings.read('sessionFile')},clientId) + + var recentSessions = settings.read('recentSessions') if (settings.read('examples')) { var dir = path.resolve(__dirname + '/../examples') diff --git a/app/main/settings.js b/app/main/settings.js index cf48544d..4423feb1 100644 --- a/app/main/settings.js +++ b/app/main/settings.js @@ -15,6 +15,7 @@ var options = { } }, 'l':{alias:'load',type:'string',file:'js',describe:'session file to load'}, + 'b':{alias:'blank',type:'boolean',describe:'load a blank session and start the editor'}, 'c':{alias:'custom-module',type:'string',file:'js',describe:'custom module file to load'}, 'p':{alias:'port',type:'number',describe:'http port of the server (default to 8080)', check: (p)=>{ @@ -87,6 +88,7 @@ var makeDefaultConfig = function(argv){ httpPort: argv.p || 8080, debug: argv.d || false, sessionFile: argv.l || false, + newSession: argv.b || false, customModule: argv.c || false, noGui: argv.n || false, guiOnly: typeof argv.g == 'string' ? argv.g.length ? argv.g : true : false,