Merge pull request #1093 from Svallinn/946-version-flag
Support for version flag
This commit is contained in:
commit
23c2cd65f7
|
@ -1,7 +1,14 @@
|
||||||
import { app, BrowserWindow, Menu, ipcMain, screen } from 'electron'
|
import { app, BrowserWindow, Menu, ipcMain, screen } from 'electron'
|
||||||
import { productName } from '../../package.json'
|
|
||||||
import Datastore from 'nedb'
|
import Datastore from 'nedb'
|
||||||
|
|
||||||
|
if (process.argv.includes('--version')) {
|
||||||
|
console.log(`v${app.getVersion()}`)
|
||||||
|
app.exit(0)
|
||||||
|
} else {
|
||||||
|
runApp()
|
||||||
|
}
|
||||||
|
|
||||||
|
function runApp() {
|
||||||
require('@electron/remote/main').initialize()
|
require('@electron/remote/main').initialize()
|
||||||
|
|
||||||
require('electron-context-menu')({
|
require('electron-context-menu')({
|
||||||
|
@ -18,9 +25,6 @@ const settingsDb = new Datastore({
|
||||||
autoload: true
|
autoload: true
|
||||||
})
|
})
|
||||||
|
|
||||||
// set app name
|
|
||||||
app.setName(productName)
|
|
||||||
|
|
||||||
// disable electron warning
|
// disable electron warning
|
||||||
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true'
|
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true'
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
@ -569,3 +573,4 @@ function setMenu () {
|
||||||
const menu = Menu.buildFromTemplate(template)
|
const menu = Menu.buildFromTemplate(template)
|
||||||
Menu.setApplicationMenu(menu)
|
Menu.setApplicationMenu(menu)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue