@@ -62,61 +62,52 @@ $commandOptions = @{
62
62
63
63
$commandOptions [' find' ] = $commandOptions [' search' ]
64
64
65
- try {
66
- $licenseFile = Get-Item - Path " $env: ChocolateyInstall \license\chocolatey.license.xml" - ErrorAction Stop
65
+ $licenseFile = Get-Item - Path " $env: ChocolateyInstall \license\chocolatey.license.xml" - ErrorAction Stop
67
66
68
- if ($licenseFile ) {
69
- # Add pro-only commands
70
- $script :chocoCommands = @ (
71
- $script :chocoCommands
72
- ' download'
73
- ' optimize'
74
- )
67
+ if ($licenseFile ) {
68
+ # Add pro-only commands
69
+ $script :chocoCommands = @ (
70
+ $script :chocoCommands
71
+ ' download'
72
+ ' optimize'
73
+ )
75
74
76
- $commandOptions.download = " --internalize --internalize-all-urls --ignore-dependencies --installed-packages --ignore-unfound-packages --resources-location='' --download-location='' --outputdirectory='' --source='' --version='' --prerelease --user='' --password='' --cert='' --certpassword='' --append-use-original-location --recompile --disable-package-repository-optimizations"
77
- $commandOptions.sync = " --output-directory='' --id='' --package-id=''"
78
- $commandOptions.optimize = " --deflate-nupkg-only --id=''"
75
+ $commandOptions.download = " --internalize --internalize-all-urls --ignore-dependencies --installed-packages --ignore-unfound-packages --resources-location='' --download-location='' --outputdirectory='' --source='' --version='' --prerelease --user='' --password='' --cert='' --certpassword='' --append-use-original-location --recompile --disable-package-repository-optimizations"
76
+ $commandOptions.sync = " --output-directory='' --id='' --package-id=''"
77
+ $commandOptions.optimize = " --deflate-nupkg-only --id=''"
79
78
80
- # Add pro switches to commands that have additional switches on Pro
81
- $proInstallUpgradeOptions = " --install-directory='' --package-parameters-sensitive='' --max-download-rate='' --install-arguments-sensitive='' --skip-download-cache --use-download-cache --skip-virus-check --virus-check --virus-positives-minimum='' --deflate-package-size --no-deflate-package-size --deflate-nupkg-only"
79
+ # Add pro switches to commands that have additional switches on Pro
80
+ $proInstallUpgradeOptions = " --install-directory='' --package-parameters-sensitive='' --max-download-rate='' --install-arguments-sensitive='' --skip-download-cache --use-download-cache --skip-virus-check --virus-check --virus-positives-minimum='' --deflate-package-size --no-deflate-package-size --deflate-nupkg-only"
82
81
83
- $commandOptions.install += $proInstallUpgradeOptions
84
- $commandOptions.upgrade += $proInstallUpgradeOptions + " --exclude-chocolatey-packages-during-upgrade-all --include-chocolatey-packages-during-upgrade-all"
85
- $commandOptions.new += " --build-package --use-original-location --keep-remote --url='' --url64='' --checksum='' --checksum64='' --checksumtype='' --pause-on-error"
86
- $commandOptions.pin += " --note=''"
82
+ $commandOptions.install += $proInstallUpgradeOptions
83
+ $commandOptions.upgrade += $proInstallUpgradeOptions + " --exclude-chocolatey-packages-during-upgrade-all --include-chocolatey-packages-during-upgrade-all"
84
+ $commandOptions.new += " --build-package --use-original-location --keep-remote --url='' --url64='' --checksum='' --checksum64='' --checksumtype='' --pause-on-error"
85
+ $commandOptions.pin += " --note=''"
87
86
88
- # Add Business-only commands and options if the license is a Business or Trial license
89
- [xml ]$xml = Get-Content - Path $licenseFile.FullName - ErrorAction Stop
90
- $licenseType = $xml.license.type
87
+ # Add Business-only commands and options if the license is a Business or Trial license
88
+ [xml ]$xml = Get-Content - Path $licenseFile.FullName - ErrorAction Stop
89
+ $licenseType = $xml.license.type
91
90
92
- if (' Business' , ' BusinessTrial' -contains $licenseType ) {
91
+ if (' Business' , ' BusinessTrial' -contains $licenseType ) {
93
92
94
- # Add business-only commands
95
- $script :chocoCommands = @ (
96
- $script :chocoCommands
97
- ' support'
98
- ' sync'
99
- )
93
+ # Add business-only commands
94
+ $script :chocoCommands = @ (
95
+ $script :chocoCommands
96
+ ' support'
97
+ ' sync'
98
+ )
100
99
101
- $commandOptions.list += " --audit"
102
- $commandOptions.uninstall += " --from-programs-and-features"
103
- $commandOptions.new += " --file='' --file64='' --from-programs-and-features --remove-architecture-from-name --include-architecture-in-name"
100
+ $commandOptions.list += " --audit"
101
+ $commandOptions.uninstall += " --from-programs-and-features"
102
+ $commandOptions.new += " --file='' --file64='' --from-programs-and-features --remove-architecture-from-name --include-architecture-in-name"
104
103
105
- # Add --use-self-service to commands that support it
106
- $selfServiceCommands = ' list' , ' find' , ' search' , ' info' , ' install' , ' upgrade' , ' uninstall' , ' pin' , ' outdated' , ' push' , ' download' , ' sync' , ' optimize'
107
- foreach ($command in $selfServiceCommands ) {
108
- $commandOptions .$command += ' --use-self-service'
109
- }
104
+ # Add --use-self-service to commands that support it
105
+ $selfServiceCommands = ' list' , ' find' , ' search' , ' info' , ' install' , ' upgrade' , ' uninstall' , ' pin' , ' outdated' , ' push' , ' download' , ' sync' , ' optimize'
106
+ foreach ($command in $selfServiceCommands ) {
107
+ $commandOptions .$command += ' --use-self-service'
110
108
}
111
109
}
112
110
}
113
- catch {
114
- # Remove the error that last occurred from $error so it doesn't cause any
115
- # issues for users, as we're deliberately ignoring it.
116
- if ($error.Count -gt 0 ) {
117
- $error.RemoveAt (0 )
118
- }
119
- }
120
111
121
112
foreach ($key in @ ($commandOptions.Keys )) {
122
113
$commandOptions .$key += $allcommands
0 commit comments