Merge pull request #1093 from Svallinn/946-version-flag

Support for version flag
This commit is contained in:
Luca Hohmann 2021-04-10 00:09:58 +02:00 committed by GitHub
commit 23c2cd65f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 468 additions and 463 deletions

View File

@ -1,7 +1,14 @@
import { app, BrowserWindow, Menu, ipcMain, screen } from 'electron'
import { productName } from '../../package.json'
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-context-menu')({
@ -18,9 +25,6 @@ const settingsDb = new Datastore({
autoload: true
})
// set app name
app.setName(productName)
// disable electron warning
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true'
const path = require('path')
@ -569,3 +573,4 @@ function setMenu () {
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
}
}