Skip to content

Commit

Permalink
added msys2 built-in profiles - fixes Eugeny#2962
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeny committed Sep 2, 2021
1 parent 601fff4 commit b7ac65f
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tabby-local/src/icons/msys2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions tabby-local/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { Cygwin64ShellProvider } from './shells/cygwin64'
import { GitBashShellProvider } from './shells/gitBash'
import { LinuxDefaultShellProvider } from './shells/linuxDefault'
import { MacOSDefaultShellProvider } from './shells/macDefault'
import { MSYS2ShellProvider } from './shells/msys2'
import { POSIXShellsProvider } from './shells/posix'
import { PowerShellCoreShellProvider } from './shells/powershellCore'
import { WindowsDefaultShellProvider } from './shells/winDefault'
Expand Down Expand Up @@ -71,6 +72,7 @@ import { LocalProfilesService } from './profiles'
{ provide: ShellProvider, useClass: Cygwin64ShellProvider, multi: true },
{ provide: ShellProvider, useClass: GitBashShellProvider, multi: true },
{ provide: ShellProvider, useClass: POSIXShellsProvider, multi: true },
{ provide: ShellProvider, useClass: MSYS2ShellProvider, multi: true },
{ provide: ShellProvider, useClass: WSLShellProvider, multi: true },
{ provide: ShellProvider, useClass: VSDevToolsProvider, multi: true },

Expand Down
40 changes: 40 additions & 0 deletions tabby-local/src/shells/msys2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import * as fs from 'fs/promises'
import * as path from 'path'
import { Injectable } from '@angular/core'
import { HostAppService, Platform } from 'tabby-core'

import { ShellProvider, Shell } from '../api'

/** @hidden */
@Injectable()
export class MSYS2ShellProvider extends ShellProvider {
constructor (
private hostApp: HostAppService,
) {
super()
}

async provide (): Promise<Shell[]> {
if (this.hostApp.platform !== Platform.Windows) {
return []
}

const msys2Path = path.resolve(process.env.SystemRoot ?? 'C:\\Windows', '../msys64')
try {
await fs.access(msys2Path)
} catch {
return []
}

const environments = ['msys', 'mingw64', 'clang64', 'ucrt64']

return environments.map(e => ({
id: `msys2-${e}`,
name: `MSYS2 (${e.toUpperCase()})`,
command: path.join(msys2Path, 'msys2_shell.cmd'),
args: ['-defterm', '-here', '-no-start', '-' + e],
icon: require('../icons/msys2.svg'),
env: {},
}))
}
}

0 comments on commit b7ac65f

Please sign in to comment.