浏览代码

(#627) Chocolatey use splatting

TheCakeIsNaOH 4 年之前
父节点
当前提交
d22d4a7389
共有 1 个文件被更改,包括 11 次插入7 次删除
  1. 11 7
      chocolatey/tools/chocolateyinstall.ps1

+ 11 - 7
chocolatey/tools/chocolateyinstall.ps1

@@ -1,13 +1,17 @@
 $ErrorActionPreference = 'Stop'; # stop on all errors
 $toolsDir              = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
+$file                  = (Join-Path $toolsDir 'SyncTrayzorSetup-x86.exe')
+$file64                = (Join-Path $toolsDir 'SyncTrayzorSetup-x64.exe')
 
-$packageName= 'SyncTrayzor'
-$file       = (Join-Path $toolsDir 'SyncTrayzorSetup-x86.exe')
-$file64     = (Join-Path $toolsDir 'SyncTrayzorSetup-x64.exe')
-$silentArgs = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- /SkipDotNetInstall'
-$fileType   = 'exe'
-$validExitCodes = @(0)
+$packageArgs = @{
+    packageName   = 'SyncTrayzor'
+    file          = $file
+    file64        = $file64
+    silentArgs    = '/VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP- /SkipDotNetInstall'
+    fileType      = 'exe'
+    validExitCodes = @(0)
+}
 
-Install-ChocolateyInstallPackage $packageName $fileType $silentArgs $file $file64 -validExitCodes $validExitCodes
+Install-ChocolateyInstallPackage @packageArgs
 
 Remove-Item -Force -ea 0 $file, $file64