added CLI option to paste text into terminal

This commit is contained in:
Eugene Pankov
2018-09-23 16:33:57 +02:00
parent 0545471f3c
commit e71d404c2b
12 changed files with 73 additions and 32 deletions

View File

@@ -74,8 +74,8 @@ export class AppService {
this.activeTabChange.next(tab)
if (this.activeTab) {
this.activeTab.emitFocused()
this.hostApp.setTitle(this.activeTab.title)
}
this.hostApp.setTitle(this.activeTab.title)
}
toggleLastTab () {

View File

@@ -1,4 +1,5 @@
import * as path from 'path'
import shellEscape = require('shell-escape')
import { Observable, Subject } from 'rxjs'
import { Injectable, NgZone, EventEmitter } from '@angular/core'
import { ElectronService } from './electron.service'
@@ -25,6 +26,7 @@ export class HostAppService {
private secondInstance = new Subject<void>()
private cliOpenDirectory = new Subject<string>()
private cliRunCommand = new Subject<string[]>()
private cliPaste = new Subject<string>()
private configChangeBroadcast = new Subject<void>()
private logger: Logger
private windowId: number
@@ -33,6 +35,7 @@ export class HostAppService {
get secondInstance$ (): Observable<void> { return this.secondInstance }
get cliOpenDirectory$ (): Observable<string> { return this.cliOpenDirectory }
get cliRunCommand$ (): Observable<string[]> { return this.cliRunCommand }
get cliPaste$ (): Observable<string> { return this.cliPaste }
get configChangeBroadcast$ (): Observable<void> { return this.configChangeBroadcast }
constructor (
@@ -76,6 +79,12 @@ export class HostAppService {
this.cliOpenDirectory.next(path.resolve(cwd, argv.directory))
} else if (op === 'run') {
this.cliRunCommand.next(argv.command)
} else if (op === 'paste') {
let text = argv.text
if (argv.escape) {
text = shellEscape([text])
}
this.cliPaste.next(text)
}
}))