feat: Sublime Text 3 Powershell Alias

This commit is contained in:
Iristyle
2013-07-23 17:13:54 -04:00
parent aabdb2b6ca
commit f4919a9a97
2 changed files with 42 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
try {
$package = 'SublimeText3.PowershellAlias'
$sublDefined = Test-Path function:subl
$profileExists = Test-Path $PROFILE
$sublInProfile = $profileExists -and (((Get-Content $PROFILE) -match '^function\s+subl\s+\.*Sublime Text 3').Count -gt 0)
# add subl alias to powershell profile
if (!$sublDefined -and !$sublInProfile)
{
New-Item (Split-Path $PROFILE) -Type Directory -ErrorAction SilentlyContinue
'function subl { &"${Env:ProgramFiles}\Sublime Text 3\sublime_text.exe" $args }' |
Out-File -FilePath $PROFILE -Append -Encoding UTF8
Write-Host 'Added subl alias to Powershell profile to launch Sublime Text 3!'
}
Write-ChocolateySuccess $package
} catch {
Write-ChocolateyFailure $package "$($_.Exception.Message)"
throw
}