mirror of
https://github.com/Eugeny/tabby.git
synced 2025-01-05 01:23:19 +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> {
|
async handle (event: CLIEvent): Promise<boolean> {
|
||||||
if (event.secondInstance) {
|
if (event.secondInstance) {
|
||||||
this.hostApp.newWindow()
|
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 () => {
|
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[]
|
const cliHandlers = injector.get(CLIHandler) as unknown as CLIHandler[]
|
||||||
cliHandlers.sort((a, b) => b.priority - a.priority)
|
cliHandlers.sort((a, b) => b.priority - a.priority)
|
||||||
@ -137,7 +138,8 @@ export class HostAppService {
|
|||||||
if (handled && handler.firstMatchOnly) {
|
if (handled && handler.firstMatchOnly) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (await handler.handle({ argv, cwd, secondInstance })) {
|
if (await handler.handle(event)) {
|
||||||
|
this.logger.info('CLI handler matched:', handler.constructor.name)
|
||||||
handled = true
|
handled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ export function stringifyKeySequence (events: EventData[]): string[] {
|
|||||||
Quote: '\'',
|
Quote: '\'',
|
||||||
BracketLeft: '[',
|
BracketLeft: '[',
|
||||||
BracketRight: ']',
|
BracketRight: ']',
|
||||||
}[key] || key
|
}[key] ?? key
|
||||||
}
|
}
|
||||||
|
|
||||||
itemKeys.push(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)) {
|
if (!fs.existsSync(cwd)) {
|
||||||
console.warn('Ignoring non-existent CWD:', cwd)
|
console.warn('Ignoring non-existent CWD:', cwd)
|
||||||
|
Loading…
Reference in New Issue
Block a user