forked from UofT-DSI/onboarding
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmisc_gitbash_wt.ps1
More file actions
19 lines (15 loc) · 1.05 KB
/
Copy pathmisc_gitbash_wt.ps1
File metadata and controls
19 lines (15 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#################################################
# Add Git Bash as a profile in Windows Terminal #
#################################################
# find out where Git is installed
$git_dir = Split-Path -parent (Split-Path -parent (Get-Command git.exe).Source)
# build the JSON fragment
$terminal_settings = @{guid = "{" + [guid]::NewGuid().ToString() + "}"; name = "Git Bash"; commandline = $git_dir + "\bin\bash.exe -i -l"; icon = $git_dir + "\mingw64\share\git\git-for-windows.ico"; hidden = $false; startingDirectory = "%USERPROFILE%" }
$terminal_settings = @{ profiles = @($terminal_settings) }
$terminal_settings = $terminal_settings | ConvertTo-Json
# make directory only if it doesn't exist
if (!(Test-Path "C:\Users\$env:UserName\AppData\Local\Microsoft\Windows Terminal\Fragments\Git")) {
mkdir "C:\Users\$env:UserName\AppData\Local\Microsoft\Windows Terminal\Fragments\Git"
}
# write the JSON fragment to file
$terminal_settings | Out-File -FilePath "C:\Users\$env:UserName\AppData\Local\Microsoft\Windows Terminal\Fragments\Git\gitbash.json" -Encoding Utf8