Skip to content

Commit

Permalink
refactor(starter): use double dash instead of triple dash to pass arg…
Browse files Browse the repository at this point in the history
…s through

BREAKING CHANGE
  • Loading branch information
MarshallOfSound committed Apr 28, 2017
1 parent 566fd6f commit e3a1be6
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion script/vscode.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion script/vscode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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\~
12 changes: 6 additions & 6 deletions src/electron-forge-start.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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");
});
Expand Down
2 changes: 1 addition & 1 deletion test/fast/electron_forge_start_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion test/fast/start_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit e3a1be6

Please sign in to comment.