| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- import * as path from 'path'
- import { Injectable } from '@angular/core'
- import { getRegistryValue } from 'windows-native-registry'
- import { HostAppService, Platform } from 'terminus-core'
- import { ShellProvider, IShell } from '../api'
- @Injectable()
- export class GitBashShellProvider extends ShellProvider {
- constructor (
- private hostApp: HostAppService,
- ) {
- super()
- }
- async provide (): Promise<IShell[]> {
- if (this.hostApp.platform !== Platform.Windows) {
- return []
- }
- let gitBashPath = getRegistryValue('HKLM', 'Software\\GitForWindows', 'InstallPath')
- if (!gitBashPath) {
- gitBashPath = getRegistryValue('HKCU', 'Software\\GitForWindows', 'InstallPath')
- }
- if (!gitBashPath) {
- return []
- }
- return [{
- id: 'git-bash',
- name: 'Git-Bash',
- command: path.join(gitBashPath, 'bin', 'bash.exe'),
- args: [ '--login', '-i' ],
- env: {
- TERM: 'cygwin',
- }
- }]
- }
- }
|