Created
August 8, 2021 20:44
-
-
Save jkavanagh58/ef8945f6c5cc8d3879f33be35ad6643d to your computer and use it in GitHub Desktop.
Copy Windows Terminal settings file for sharing/backup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[CmdletBinding()] | |
Param ( | |
[parameter(Mandatory = $False, ValueFromPipeline = $True, | |
HelpMessage = "wt settings file")] | |
[System.IO.FileInfo]$wtSettings = 'C:\Users\johnk\AppData\Local\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json', | |
[parameter(Mandatory = $False, ValueFromPipeline = $False, | |
HelpMessage = "Name of file for update")] | |
[System.String]$wtRepoFile = "wt_settings_jkav.json", | |
[parameter(Mandatory = $False, ValueFromPipeline = $True, | |
HelpMessage = "Path to local clone")] | |
[System.IO.DirectoryInfo]$wtRepoPath = 'C:\Users\johnk\Documents\github\slackgroup\Terminal', | |
[parameter(Mandatory = $False, ValueFromPipeline = $False, | |
HelpMessage = "Full repo path")] | |
[System.String]$wtrepoFullPath = (Join-Path -Path $wtRepoPath -ChildPath $wtRepoFile) | |
) | |
BEGIN { | |
Try { | |
# Verify wt settings file exists | |
$wtSettings.Exists | |
} | |
Catch { | |
Write-Warning -Message "Unable to find Windows Terminal Settings File" | |
EXIT | |
} | |
} | |
PROCESS { | |
Copy-Item $wtSettings -Destination $wtrepoFullPath | |
Set-Location $wtRepoPath | |
# Still working on this LF/CRLF thing | |
git local --global core.autocrlf false | |
git add $wtrepoFullPath | |
git commit -m "JK Updated Windows Terminal Settings file (auto)" | |
git push | |
} | |
END { | |
Remove-Variable -Name wtSettings | |
[System.GC]::Collect() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment