Skip to content

Commit

Permalink
Simplify Processing Arguments in Node.js CLI (#178)
Browse files Browse the repository at this point in the history
* Simplify processArgs()

* rename Launcher

* Rename WindowConfig

* Rename BrowserWindow
  • Loading branch information
kruplm authored Mar 14, 2023
1 parent cd9c7a3 commit f438155
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WindowConfig } from './WindowConfig';
import { WindowConfig } from './windowConfig';
import { Launcher } from './launcher.js';

export class BrowserWindow {
Expand Down
4 changes: 2 additions & 2 deletions src/shell/js/composeui-node-launcher/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { BrowserWindow } from './BrowserWindow.js';
export { BrowserWindow } from './browserWindow.js';
export { Launcher } from './launcher.js';
export { WindowConfig } from './WindowConfig.js';
export { WindowConfig } from './windowConfig.js';
export * from './cli/cli.js';
export { executeScriptFile } from './cli/executeScrtiptFile.js';
2 changes: 1 addition & 1 deletion src/shell/js/composeui-node-launcher/src/launcher.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Launcher } from './launcher';
import { WindowConfig } from './WindowConfig';
import { WindowConfig } from './windowConfig';

describe('Launcher', () => {
let testWindowConfig: WindowConfig;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,13 @@
import { execFile } from 'child_process';
import { WindowConfig } from './WindowConfig';
import { WindowConfig } from './windowConfig';

export class Launcher {
private processArgs(config?: WindowConfig) {
let argsArray = [];
if (config) {
if (config?.title) {
argsArray.push(`--title=${config.title}`);
for (const [key, value] of Object.entries(config)) {
argsArray.push(`--${key}=${value}`);
}
if(config?.icon) {
argsArray.push(`--icon=${config.icon}`)
}
if (config?.url) {
argsArray.push(`--url=${config.url}`);
}

if (config?.width) {
argsArray.push(`--width=${config.width}`);
}

if (config?.height) {
argsArray.push(`--height=${config.height}`);
}
}

return argsArray;
Expand Down

0 comments on commit f438155

Please sign in to comment.