title: Calling commandline in Electron not showing GUI
body: <p>What is the proper way to implement commandline support in an electron app without showing the gui, but executing the code and closing the application?</p>
  <p>I couldn't find any samples online of a proper way to implement this. I was wondering if i should replace the
  <code>app.on(&quot;ready&quot;, createWindow);</code> with a different method like <code>init()</code> that checks if there are any commandline args otherwise proceed as normal like the following...</p>
  <pre><code>import { app, BrowserWindow, nativeTheme } from &quot;electron&quot;;
  import path from &quot;path&quot;;
  
  let mainWindow;
  
  function createWindow() {
    /**
     * Initial window options
     */
    console.log(&quot;running application....&quot;);
    mainWindow = new BrowserWindow({
      width: 1000,
      height: 960,
      useContentSize: true,
      webPreferences: {
        contextIsolation: true,
        enableRemoteModule: true,
        preload: path.resolve(__dirname, process.env.QUASAR_ELECTRON_PRELOAD),
      },
    });
  
    mainWindow.loadURL(process.env.APP_URL);
  
    if (process.env.DEBUGGING) {
      // if on DEV or Production with debug enabled
      mainWindow.webContents.openDevTools();
    } else {
      // we're on production; no access to devtools pls
      mainWindow.webContents.on(&quot;devtools-opened&quot;, () =&gt; {
        mainWindow.webContents.closeDevTools();
      });
    }
  
    mainWindow.on(&quot;closed&quot;, () =&gt; {
      mainWindow = null;
    });
  }
  
  function processArgs() {
    console.log(&quot;running commandline....&quot;);
  }
  
  app.on(&quot;ready&quot;, createWindow); // REPLACE createWindow with init method that checks and then calls createWindow is no args are supplied?
  
  app.on(&quot;window-all-closed&quot;, () =&gt; {
    if (process.platform !== &quot;darwin&quot;) {
      app.quit();
    }
  });
  
  app.on(&quot;activate&quot;, () =&gt; {
    if (mainWindow === null) {
      createWindow();
    }
  });
  
  </code></pre>