localProfileSettings.component.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /* eslint-disable @typescript-eslint/explicit-module-boundary-types */
  2. import { Component, Inject, Optional } from '@angular/core'
  3. import { LocalProfile, UACService } from '../api'
  4. import { PlatformService, ProfileSettingsComponent } from 'tabby-core'
  5. /** @hidden */
  6. @Component({
  7. templateUrl: './localProfileSettings.component.pug',
  8. })
  9. export class LocalProfileSettingsComponent implements ProfileSettingsComponent<LocalProfile> {
  10. profile: LocalProfile
  11. constructor (
  12. @Optional() @Inject(UACService) public uac: UACService|undefined,
  13. private platform: PlatformService,
  14. ) { }
  15. ngOnInit () {
  16. this.profile.options.env = this.profile.options.env ?? {}
  17. this.profile.options.args = this.profile.options.args ?? []
  18. }
  19. async pickWorkingDirectory (): Promise<void> {
  20. // const profile = await this.terminal.getProfileByID(this.config.store.terminal.profile)
  21. // const shell = this.shells.find(x => x.id === profile?.shell)
  22. // if (!shell) {
  23. // return
  24. // }
  25. const cwd = await this.platform.pickDirectory()
  26. if (!cwd) {
  27. return
  28. }
  29. this.profile.options.cwd = cwd
  30. }
  31. }