feat(SublimeText2.PowershellAlias) - new pkg
- refactored out of existing SublimeText2.app
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>SublimeText2.PowershellAlias</id>
|
||||
<title>Sublime Text 2 Powershell subl Alias</title>
|
||||
<version>0.1.0</version>
|
||||
<authors>Jon Skinner</authors>
|
||||
<owners>Ethan J Brown</owners>
|
||||
<summary>A Powershell 'subl' alias to easily launch Sublime Text 2 from the command line. Sublime Text 2 is a sophisticated text editor for code, html and prose.</summary>
|
||||
<description>Assumes Sublime Text 2 is already installed to the default location on disk.</description>
|
||||
<releaseNotes></releaseNotes>
|
||||
<projectUrl>http://www.sublimetext.com/2</projectUrl>
|
||||
<tags>sublime text editor powershell</tags>
|
||||
<licenseUrl>http://www.sublimetext.com/eula</licenseUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<iconUrl>https://github.com/Iristyle/ChocolateyPackages/raw/master/SublimeText2.app/Sublime_Text.png</iconUrl>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="tools\**" target="tools" />
|
||||
</files>
|
||||
</package>
|
21
SublimeText2.PowershellAlias/tools/ChocolateyInstall.ps1
Normal file
21
SublimeText2.PowershellAlias/tools/ChocolateyInstall.ps1
Normal file
@@ -0,0 +1,21 @@
|
||||
try {
|
||||
$package = 'SublimeText2.PowershellAlias'
|
||||
|
||||
$sublDefined = Test-Path function:subl
|
||||
$profileExists = Test-Path $PROFILE
|
||||
$sublInProfile = $profileExists -and (((Get-Content $PROFILE) -match '^function\s+subl\s+').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 2\sublime_text.exe" $args }' |
|
||||
Out-File -FilePath $PROFILE -Append -Encoding UTF8
|
||||
Write-Host 'Added subl alias to Powershell profile to launch Sublime Text 2!'
|
||||
}
|
||||
|
||||
Write-ChocolateySuccess $package
|
||||
} catch {
|
||||
Write-ChocolateyFailure $package "$($_.Exception.Message)"
|
||||
throw
|
||||
}
|
Reference in New Issue
Block a user