Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
AtomicSponge committed Jun 25, 2024
1 parent 45e4583 commit fca9e9e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion electron/lib/AppSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class AppSettings {
* @param load Load data or not
*/
constructor(load:boolean) {
if(load) {
if (load) {
try {
this.load()
} catch (error:any) {
Expand Down
10 changes: 5 additions & 5 deletions electron/lib/ScriptBuffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class ScriptBuffer extends EventEmitter {
ScriptBuffer.#buffer = []
ScriptBuffer.#size = this.#check(size)

if(load) {
if (load) {
try {
this.load()
} catch (error:any) {
Expand Down Expand Up @@ -118,7 +118,7 @@ export class ScriptBuffer extends EventEmitter {
data += `Duration: ${item.duration} ms\n\n`
data += `Stdout:\n${item.out}\n\n`
data += `Stderr:\n${item.err}\n`
if(idx < (ScriptBuffer.#buffer.length - 1))
if (idx < (ScriptBuffer.#buffer.length - 1))
data += `\n${'-'.repeat(20)}\n\n`
})
try {
Expand Down Expand Up @@ -159,7 +159,7 @@ export class ScriptBuffer extends EventEmitter {

/** Trim the buffer to max size */
#trim():void {
if(ScriptBuffer.#buffer.length > ScriptBuffer.#size)
if (ScriptBuffer.#buffer.length > ScriptBuffer.#size)
ScriptBuffer.#buffer = ScriptBuffer.#buffer.slice(-ScriptBuffer.#size)
}

Expand All @@ -169,8 +169,8 @@ export class ScriptBuffer extends EventEmitter {
* @returns Value adjusted if above max or below min
*/
#check(val:number) {
if(val < ScriptBuffer.#minSize) val = ScriptBuffer.#minSize
if(val > ScriptBuffer.#maxSize) val = ScriptBuffer.#maxSize
if (val < ScriptBuffer.#minSize) val = ScriptBuffer.#minSize
if (val > ScriptBuffer.#maxSize) val = ScriptBuffer.#maxSize
return val
}

Expand Down
9 changes: 4 additions & 5 deletions electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ process.env.VITE_PUBLIC = process.env.VITE_DEV_SERVER_URL ? path.join(process.en
/** Process command arguments */
const flags = { trayData: true, bufferData: true }
process.argv.forEach(arg => {
if(arg === '--no-load-traydata') flags.trayData = false
if(arg === '--no-load-bufferdata') flags.bufferData = false
if (arg === '--no-load-traydata') flags.trayData = false
if (arg === '--no-load-bufferdata') flags.bufferData = false
})

/** App information */
Expand Down Expand Up @@ -191,7 +191,7 @@ ipcMain.on('save-settings-data', (_event, data) => {
}

if (data.check) {
if(!appSettings.compareData(data)) {
if (!appSettings.compareData(data)) {
saveDataPrompt(data, 'Settings have changed! Do you want to save?')
}
} else {
Expand Down Expand Up @@ -460,8 +460,7 @@ const buildMenu = ():Menu => {
*/
const CommandRunner = (execCmd:string, item:TrayCommand):void => {
const cmdCwd = (() => {
if (fs.existsSync(item.cwd)) return item.cwd
else return process.cwd()
return (fs.existsSync(item.cwd)) ? item.cwd : process.cwd()
})()
const execOpts = {
encoding: appSettings.encoding,
Expand Down

0 comments on commit fca9e9e

Please sign in to comment.