Skip to content

Commit

Permalink
v0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
mica committed Feb 18, 2018
1 parent 9e7bf99 commit 67abdb6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Package/ChocoShortcuts.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<metadata>
<id>ChocoShortcuts</id>
<title>Chocolatey Shortcuts (unofficial)</title>
<version>0.2</version>
<version>0.3</version>
<authors>mica</authors>
<owners>mica</owners>
<projectUrl>https://github.com/mica/ChocoShortcuts</projectUrl>
Expand All @@ -29,13 +29,13 @@ Create shortcuts for packages using "+Add Package Shortcuts". There you'll find
Launching package shortcuts will present you with options to install (if not installed), update (if available), or uninstall packages. Update multiple packages at once using "+Check for Package Updates".
</description>
<releaseNotes>
- Now can install with options, which can be embedded in the shortcut or entered as a one-off
- Switched to CMD for passing the working directory to an elevated PowerShell prompt (because of this bug: https://goo.gl/BrsnfO)
- Added colored text
- Fixed the bulk update function, which had been giving only a partal list of outdated packages since Chocolatey v0.10.5
- Added uninstall script for removing the initial two shortcuts if the folder is otherwise empty
</releaseNotes>
</metadata>
<files>
<file src="Tools\ChocolateyInstall.ps1" target="Tools" />
<file src="Tools\ChocolateyUninstall.ps1" target="Tools" />
<file src="Tools\ChocoShortcuts.ps1" target="Tools" />
</files>
</package>
6 changes: 3 additions & 3 deletions Package/Tools/ChocoShortcuts.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Chocolatey Shortcuts v0.2
# Chocolatey Shortcuts v0.3
# https://github.com/mica/ChocoShortcuts/

param([Parameter(Position = 0)] [string]$App = $App, [string]$Opt)
Expand Down Expand Up @@ -293,14 +293,14 @@ function UpdateCheck {
Clear-Host; Header
'Checking Chocolatey.org for updates...'
$Outdated = choco outdated -r | Where-Object {$_ -notmatch '.install'}
if ($Outdated[3] -eq $null) {
if ($Outdated -eq $null) {
Clear-Host; Header
'No updates are available';''
(w 'Press ')+(y 'Enter ')+'to exit'; Read-Host
Exit
}
else {
$Updates = ForEach ($Package in $Outdated[3..($Outdated.Length)]) {
$Updates = ForEach ($Package in $Outdated[0..($Outdated.Length)]) {
$Package -replace '\|(\d*\.)*\d*\|',' v' -replace '\|\D*$'
}
if ($Updates -isnot [system.array]) {
Expand Down
8 changes: 4 additions & 4 deletions Package/Tools/ChocolateyInstall.ps1
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
$InstallDir = [Environment]::GetFolderPath('Desktop')+'\Chocolatey Shortcuts'
$dir = "$env:USERPROFILE\Desktop\Chocolatey Shortcuts"
Install-ChocolateyShortcut `
-ShortcutFilePath "$InstallDir\+Add Package Shortcuts.lnk" `
-ShortcutFilePath "$dir\+Add Package Shortcuts.lnk" `
-TargetPath 'CMD' `
-Arguments "/C PowerShell `"SL -PSPath `'%CD%`'; `$Path = (GL).Path; SL ~; Start PowerShell -Verb RunAs -Args \`"-NoProfile -ExecutionPolicy Unrestricted `"SL -PSPath `'`"`$Path`"`'; & `'`"%ChocolateyInstall%\lib\ChocoShortcuts\Tools\ChocoShortcuts.ps1`"`' 1`"\`"`"" `
-IconLocation '%ProgramData%\chocolatey\choco.exe'
Install-ChocolateyShortcut `
-ShortcutFilePath "$InstallDir\+Check for Package Updates.lnk" `
-ShortcutFilePath "$dir\+Check for Package Updates.lnk" `
-TargetPath 'CMD' `
-Arguments "/C PowerShell `"SL -PSPath `'%CD%`'; `$Path = (GL).Path; SL ~; Start PowerShell -Verb RunAs -Args \`"-NoProfile -ExecutionPolicy Unrestricted `"SL -PSPath `'`"`$Path`"`'; & `'`"%ChocolateyInstall%\lib\ChocoShortcuts\Tools\ChocoShortcuts.ps1`"`' 2`"\`"`"" `
-IconLocation '%ProgramData%\chocolatey\choco.exe'
Invoke-Item $InstallDir
Invoke-Item $dir
8 changes: 8 additions & 0 deletions Package/Tools/ChocolateyUninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
$dir = "$env:USERPROFILE\Desktop\Chocolatey Shortcuts"
$lnk1 = "$dir\+Add Package Shortcuts.lnk"
$lnk2 = "$dir\+Check for Package Updates.lnk"
if (Test-Path $dir) {
if ((((Get-ChildItem $dir).Length -le 2) -and (Test-Path $lnk1) -and (Test-Path $lnk2)) -or (Get-ChildItem $dir).Length -eq 0) {
Remove-Item $dir -Recurse
}
}

0 comments on commit 67abdb6

Please sign in to comment.