A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.electronjs.org/docs/latest/api/command-line below:

Class: CommandLine | Electron

Class: CommandLine Class: CommandLine​

Manipulate the command line arguments for your app that Chromium reads

Process: Main
This class is not exported from the 'electron' module. It is only available as a return value of other methods in the Electron API.

The following example shows how to check if the --disable-gpu flag is set.

const { app } = require('electron')
app.commandLine.hasSwitch('disable-gpu')

For more information on what kinds of flags and switches you can use, check out the Command Line Switches document.

Instance Methods​ commandLine.appendSwitch(switch[, value])​

Append a switch (with optional value) to Chromium's command line.

note

This will not affect process.argv. The intended usage of this function is to control Chromium's behavior.

const { app } = require('electron')

app.commandLine.appendSwitch('remote-debugging-port', '8315')
commandLine.appendArgument(value)​

Append an argument to Chromium's command line. The argument will be quoted correctly. Switches will precede arguments regardless of appending order.

If you're appending an argument like --switch=value, consider using appendSwitch('switch', 'value') instead.

const { app } = require('electron')

app.commandLine.appendArgument('--enable-experimental-web-platform-features')

note

This will not affect process.argv. The intended usage of this function is to control Chromium's behavior.

commandLine.hasSwitch(switch)​

Returns boolean - Whether the command-line switch is present.

const { app } = require('electron')

app.commandLine.appendSwitch('remote-debugging-port', '8315')
const hasPort = app.commandLine.hasSwitch('remote-debugging-port')
console.log(hasPort)
commandLine.getSwitchValue(switch)​

Returns string - The command-line switch value.

This function is meant to obtain Chromium command line switches. It is not meant to be used for application-specific command line arguments. For the latter, please use process.argv.

const { app } = require('electron')

app.commandLine.appendSwitch('remote-debugging-port', '8315')
const portValue = app.commandLine.getSwitchValue('remote-debugging-port')
console.log(portValue)

note

When the switch is not present or has no value, it returns empty string.

commandLine.removeSwitch(switch)​

Removes the specified switch from Chromium's command line.

const { app } = require('electron')

app.commandLine.appendSwitch('remote-debugging-port', '8315')
console.log(app.commandLine.hasSwitch('remote-debugging-port'))

app.commandLine.removeSwitch('remote-debugging-port')
console.log(app.commandLine.hasSwitch('remote-debugging-port'))

note

This will not affect process.argv. The intended usage of this function is to control Chromium's behavior.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4