Skip to content
Permalink
Browse files

refactor(starter): use double dash instead of triple dash to pass arg…

…s through

BREAKING CHANGE
  • Loading branch information
MarshallOfSound committed Apr 27, 2017
1 parent 566fd6f commit e3a1be64402add939085fd6c0eb7e2ded3da5d4e
Showing with 10 additions and 10 deletions.
  1. +1 −1 script/vscode.cmd
  2. +1 −1 script/vscode.sh
  3. +6 −6 src/electron-forge-start.js
  4. +1 −1 test/fast/electron_forge_start_spec.js
  5. +1 −1 test/fast/start_spec.js
@@ -4,6 +4,6 @@ SETLOCAL
SET FORGE_ARGS=%*

SET FORGE_ARGS=%FORGE_ARGS: =~ ~%
node "%~dp0/../../electron-forge/dist/electron-forge-start.js" --vscode --- ~%FORGE_ARGS%~
node "%~dp0/../../electron-forge/dist/electron-forge-start.js" --vscode -- ~%FORGE_ARGS%~

ENDLOCAL
@@ -4,4 +4,4 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ARGS=$@
ARGS=${ARGS// /\~ \~}

node $DIR/../electron-forge/dist/electron-forge-start --vscode --- \~$ARGS\~
node $DIR/../electron-forge/dist/electron-forge-start --vscode -- \~$ARGS\~
@@ -9,10 +9,10 @@ import { start } from './api';
let commandArgs = process.argv;
let appArgs;

const tripleDashIndex = process.argv.indexOf('---');
if (tripleDashIndex !== -1) {
commandArgs = process.argv.slice(0, tripleDashIndex);
appArgs = process.argv.slice(tripleDashIndex + 1);
const doubleDashIndex = process.argv.indexOf('--');
if (doubleDashIndex !== -1) {
commandArgs = process.argv.slice(0, doubleDashIndex);
appArgs = process.argv.slice(doubleDashIndex + 1);
}

let dir = process.cwd();
@@ -34,9 +34,9 @@ import { start } from './api';
.parse(commandArgs);

program.on('--help', () => {
console.log(" Any arguments found after '---' will be passed to the Electron app, e.g.");
console.log(" Any arguments found after '--' will be passed to the Electron app, e.g.");
console.log('');
console.log(' $ electron-forge /path/to/project -l --- -d -f foo.txt');
console.log(' $ electron-forge /path/to/project -l -- -d -f foo.txt');
console.log('');
console.log(" will pass the arguments '-d -f foo.txt' to the Electron app");
});
@@ -86,7 +86,7 @@ describe('electron-forge start', () => {
});

it('should handle app args', async () => {
await runCommand(['-l', '---', '-a', 'foo', '-l']);
await runCommand(['-l', '--', '-a', 'foo', '-l']);
expect(startStub.callCount).to.equal(1);
expect(startStub.firstCall.args[0]).to.deep.equal({
dir: process.cwd(),
@@ -131,7 +131,7 @@ describe('start', () => {
});

it('should remove all "~" from args when in VSCode debug mode', (done) => {
process.argv = ['--vscode', '---', '--foo', 'bar', 'this arg exists'];
process.argv = ['--vscode', '--', '--foo', 'bar', 'this arg exists'];
proxyquire.noCallThru().load('../../src/electron-forge-start', {
'./api': {
start: (startOptions) => {

0 comments on commit e3a1be6

Please sign in to comment.
You can’t perform that action at this time.