feat: add app.commandLine.hasSwitch() / app.commandLine.getSwitchValue() (#16282)
* feat: add app.commandLine.hasSwitch() / app.commandLine.getSwitchValue() * add more tests * refactor: move appendSwitch / appendArgument to command_line module * replace AppendSwitchASCII with AppendSwitchNative * remove castArgs
This commit is contained in:
parent
5957ede41a
commit
6f117b8e0c
7 changed files with 135 additions and 38 deletions
|
@ -1,6 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const bindings = process.atomBinding('app')
|
||||
const commandLine = process.atomBinding('command_line')
|
||||
const path = require('path')
|
||||
const { app, App } = bindings
|
||||
|
||||
|
@ -25,18 +26,10 @@ Object.assign(app, {
|
|||
return Menu.getApplicationMenu()
|
||||
},
|
||||
commandLine: {
|
||||
appendSwitch (...args) {
|
||||
const castedArgs = args.map((arg) => {
|
||||
return typeof arg !== 'string' ? `${arg}` : arg
|
||||
})
|
||||
return bindings.appendSwitch(...castedArgs)
|
||||
},
|
||||
appendArgument (...args) {
|
||||
const castedArgs = args.map((arg) => {
|
||||
return typeof arg !== 'string' ? `${arg}` : arg
|
||||
})
|
||||
return bindings.appendArgument(...castedArgs)
|
||||
}
|
||||
hasSwitch: (...args) => commandLine.hasSwitch(...args.map(String)),
|
||||
getSwitchValue: (...args) => commandLine.getSwitchValue(...args.map(String)),
|
||||
appendSwitch: (...args) => commandLine.appendSwitch(...args.map(String)),
|
||||
appendArgument: (...args) => commandLine.appendArgument(...args.map(String))
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue