mirror of
https://github.com/Eugeny/tabby.git
synced 2025-04-12 16:10:26 +08:00
added auto detection for vs developer prompt
This commit is contained in:
parent
d3498a6a46
commit
0aa5df421d
1
tabby-local/src/icons/vs.svg
Normal file
1
tabby-local/src/icons/vs.svg
Normal file
@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 96 95.51"><defs><style>.a{fill:#fff;}.a,.h{fill-rule:evenodd;}.b{mask:url(#a);}.c{fill:#52218a;}.d{fill:#6c33af;}.e{fill:#854cc7;}.f{fill:#b179f1;}.g{opacity:0.25;}.h{fill:url(#b);}</style><mask id="a" x="0" y="0" width="96" height="95.51" maskUnits="userSpaceOnUse"><g transform="translate(0 -0.25)"><path class="a" d="M68.89,95.6a6,6,0,0,0,3.93-.44L92.6,85.65A6,6,0,0,0,96,80.24V15.76a6,6,0,0,0-3.4-5.41L72.82.84A6,6,0,0,0,68.34.55,6,6,0,0,0,66,2L34.12,37.26,15.5,22l-1.63-1.4a4,4,0,0,0-3.61-.83,2.55,2.55,0,0,0-.53.18L2.46,23A4,4,0,0,0,0,26.37c0,.1,0,.2,0,.3V69.33c0,.1,0,.2,0,.3A4,4,0,0,0,2.46,73l7.27,3a2.55,2.55,0,0,0,.53.18,4,4,0,0,0,3.61-.83L15.5,74,34.12,58.74,66,94A6,6,0,0,0,68.89,95.6ZM72,27.68,47.21,48,72,68.32ZM12,34.27,24.41,48,12,61.73Z"></path></g></mask><linearGradient id="b" x1="48" y1="97.75" x2="48" y2="2.25" gradientTransform="matrix(1, 0, 0, -1, 0, 98)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#fff"></stop><stop offset="1" stop-color="#fff" stop-opacity="0"></stop></linearGradient></defs><title>BrandVisualStudioWin2019</title><g class="b"><path class="c" d="M13.87,75.4a4,4,0,0,1-4.14.65L2.46,73A4,4,0,0,1,0,69.33V26.67A4,4,0,0,1,2.46,23l7.27-3a4,4,0,0,1,4.14.65L15.5,22A2.21,2.21,0,0,0,12,23.8V72.2A2.21,2.21,0,0,0,15.5,74Z" transform="translate(0 -0.25)"></path><path class="d" d="M2.46,73A4,4,0,0,1,0,69.33V69a2.31,2.31,0,0,0,4,1.55L66,2A6,6,0,0,1,72.82.84L92.6,10.36A6,6,0,0,1,96,15.77V16a3.79,3.79,0,0,0-6.19-2.93L15.5,74l-1.63,1.4a4,4,0,0,1-4.14.65Z" transform="translate(0 -0.25)"></path><path class="e" d="M2.46,23A4,4,0,0,0,0,26.67V27a2.31,2.31,0,0,1,4-1.55L66,94a6,6,0,0,0,6.82,1.16L92.6,85.64A6,6,0,0,0,96,80.23V80a3.79,3.79,0,0,1-6.19,2.93L15.5,22l-1.63-1.4A4,4,0,0,0,9.73,20Z" transform="translate(0 -0.25)"></path><path class="f" d="M72.82,95.16A6,6,0,0,1,66,94a3.52,3.52,0,0,0,6-2.49v-87A3.52,3.52,0,0,0,66,2,6,6,0,0,1,72.82.84L92.6,10.35A6,6,0,0,1,96,15.76V80.24a6,6,0,0,1-3.4,5.41Z" transform="translate(0 -0.25)"></path><g class="g"><path class="h" d="M68.89,95.6a6,6,0,0,0,3.93-.44L92.6,85.65A6,6,0,0,0,96,80.24V15.76a6,6,0,0,0-3.4-5.41L72.82.84A6,6,0,0,0,68.34.55,6,6,0,0,0,66,2L34.12,37.26,15.5,22l-1.63-1.4a4,4,0,0,0-3.61-.83,2.55,2.55,0,0,0-.53.18L2.46,23A4,4,0,0,0,0,26.37c0,.1,0,.2,0,.3V69.33c0,.1,0,.2,0,.3A4,4,0,0,0,2.46,73l7.27,3a2.55,2.55,0,0,0,.53.18,4,4,0,0,0,3.61-.83L15.5,74,34.12,58.74,66,94A6,6,0,0,0,68.89,95.6ZM72,27.68,47.21,48,72,68.32ZM12,34.27,24.41,48,12,61.73Z" transform="translate(0 -0.25)"></path></g></g></svg>
|
After Width: | Height: | Size: 2.6 KiB |
@ -38,6 +38,7 @@ import { PowerShellCoreShellProvider } from './shells/powershellCore'
|
||||
import { WindowsDefaultShellProvider } from './shells/winDefault'
|
||||
import { WindowsStockShellsProvider } from './shells/windowsStock'
|
||||
import { WSLShellProvider } from './shells/wsl'
|
||||
import { VSDevToolsProvider } from './shells/vs'
|
||||
|
||||
import { AutoOpenTabCLIHandler, OpenPathCLIHandler, TerminalCLIHandler } from './cli'
|
||||
import { LocalProfilesService } from './profiles'
|
||||
@ -73,6 +74,7 @@ import { LocalProfilesService } from './profiles'
|
||||
{ provide: ShellProvider, useClass: GitBashShellProvider, multi: true },
|
||||
{ provide: ShellProvider, useClass: POSIXShellsProvider, multi: true },
|
||||
{ provide: ShellProvider, useClass: WSLShellProvider, multi: true },
|
||||
{ provide: ShellProvider, useClass: VSDevToolsProvider, multi: true },
|
||||
|
||||
{ provide: ProfileProvider, useClass: LocalProfilesService, multi: true },
|
||||
|
||||
|
68
tabby-local/src/shells/vs.ts
Normal file
68
tabby-local/src/shells/vs.ts
Normal file
@ -0,0 +1,68 @@
|
||||
import * as path from 'path'
|
||||
import * as fs from 'fs/promises'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { HostAppService, Platform } from 'tabby-core'
|
||||
|
||||
import { ShellProvider, Shell } from '../api'
|
||||
|
||||
/** @hidden */
|
||||
@Injectable()
|
||||
export class VSDevToolsProvider extends ShellProvider {
|
||||
constructor (
|
||||
private hostApp: HostAppService,
|
||||
) {
|
||||
super()
|
||||
}
|
||||
|
||||
async provide (): Promise<Shell[]> {
|
||||
if (this.hostApp.platform !== Platform.Windows) {
|
||||
return []
|
||||
}
|
||||
|
||||
const parentPath = path.join(process.env['programfiles(x86)'] ?? 'C:\\Program Files (x86', 'Microsoft Visual Studio')
|
||||
|
||||
try {
|
||||
await fs.stat(parentPath)
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
|
||||
const result: Shell[] = []
|
||||
for (const version of await fs.readdir(parentPath)) {
|
||||
const bat = path.join(parentPath, version, 'Community\\Common7\\Tools\\VsDevCmd.bat')
|
||||
try {
|
||||
await fs.stat(bat)
|
||||
} catch {
|
||||
continue
|
||||
}
|
||||
result.push({
|
||||
id: `vs-cmd-${version}`,
|
||||
name: `Developer Prompt for VS ${version}`,
|
||||
command: 'cmd.exe',
|
||||
args: ['/k', bat],
|
||||
icon: require('../icons/vs.svg'),
|
||||
env: {},
|
||||
})
|
||||
}
|
||||
return result
|
||||
|
||||
// return [
|
||||
// {
|
||||
// id: 'cmderps',
|
||||
// name: 'Cmder PowerShell',
|
||||
// command: 'powershell.exe',
|
||||
// args: [
|
||||
// '-ExecutionPolicy',
|
||||
// 'Bypass',
|
||||
// '-nologo',
|
||||
// '-noprofile',
|
||||
// '-noexit',
|
||||
// '-command',
|
||||
// `Invoke-Expression '. ''${path.join(process.env.CMDER_ROOT, 'vendor', 'profile.ps1')}'''`,
|
||||
// ],
|
||||
// icon: require('../icons/cmder-powershell.svg'),
|
||||
// env: {},
|
||||
// },
|
||||
// ]
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user