mirror of
https://github.com/Eugeny/tabby.git
synced 2025-01-02 23:45:45 +03:00
cli fixes
This commit is contained in:
parent
fa07fdcb64
commit
3f40098ffb
@ -14,7 +14,8 @@ export class LastCLIHandler extends CLIHandler {
|
||||
async handle (event: CLIEvent): Promise<boolean> {
|
||||
if (event.secondInstance) {
|
||||
this.hostApp.newWindow()
|
||||
return true
|
||||
}
|
||||
return true
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,8 @@ export class HostAppService {
|
||||
})
|
||||
|
||||
electron.ipcRenderer.on('cli', (_$event, argv: any, cwd: string, secondInstance: boolean) => this.zone.run(async () => {
|
||||
this.logger.info('CLI arguments received:', argv)
|
||||
const event = { argv, cwd, secondInstance }
|
||||
this.logger.info('CLI arguments received:', event)
|
||||
|
||||
const cliHandlers = injector.get(CLIHandler) as unknown as CLIHandler[]
|
||||
cliHandlers.sort((a, b) => b.priority - a.priority)
|
||||
@ -137,7 +138,8 @@ export class HostAppService {
|
||||
if (handled && handler.firstMatchOnly) {
|
||||
continue
|
||||
}
|
||||
if (await handler.handle({ argv, cwd, secondInstance })) {
|
||||
if (await handler.handle(event)) {
|
||||
this.logger.info('CLI handler matched:', handler.constructor.name)
|
||||
handled = true
|
||||
}
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ export function stringifyKeySequence (events: EventData[]): string[] {
|
||||
Quote: '\'',
|
||||
BracketLeft: '[',
|
||||
BracketRight: ']',
|
||||
}[key] || key
|
||||
}[key] ?? key
|
||||
}
|
||||
|
||||
itemKeys.push(key)
|
||||
|
@ -190,7 +190,8 @@ export class Session extends BaseSession {
|
||||
})
|
||||
}
|
||||
|
||||
let cwd = options.cwd ?? process.env.HOME
|
||||
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
||||
let cwd = options.cwd || process.env.HOME
|
||||
|
||||
if (!fs.existsSync(cwd)) {
|
||||
console.warn('Ignoring non-existent CWD:', cwd)
|
||||
|
Loading…
Reference in New Issue
Block a user