Skip to content

Commit

Permalink
(GH-808) Allow silent args as array
Browse files Browse the repository at this point in the history
Some packages have passed silent arguments as an array. Allow
specifying it as a string array and then join the arguments together.
  • Loading branch information
ferventcoder committed Jun 23, 2016
1 parent 35585c3 commit d6c7fc8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,15 @@ param(
[parameter(Mandatory=$true, Position=0)][string] $packageName,
[parameter(Mandatory=$false, Position=1)]
[alias("installerType","installType")][string] $fileType = 'exe',
[parameter(Mandatory=$false, Position=2)][string] $silentArgs = '',
[parameter(Mandatory=$false, Position=2)][string[]] $silentArgs = '',
[parameter(Mandatory=$true, Position=3)][string] $file,
[parameter(Mandatory=$false)] $validExitCodes = @(0),
[parameter(Mandatory=$false)]
[alias("useOnlyPackageSilentArgs")][switch] $useOnlyPackageSilentArguments = $false,
[parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)
[string]$silentArgs = $silentArgs -join ' '

Write-Debug "Running 'Install-ChocolateyInstallPackage' for $packageName with file:`'$file`', args: `'$silentArgs`', fileType: `'$fileType`', validExitCodes: `'$validExitCodes`', useOnlyPackageSilentArguments: '$($useOnlyPackageSilentArguments.IsPresent)'";
$installMessage = "Installing $packageName..."
Write-Host $installMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ param(
[parameter(Mandatory=$true, Position=0)][string] $packageName,
[parameter(Mandatory=$false, Position=1)]
[alias("installerType","installType")][string] $fileType = 'exe',
[parameter(Mandatory=$false, Position=2)][string] $silentArgs = '',
[parameter(Mandatory=$false, Position=2)][string[]] $silentArgs = '',
[parameter(Mandatory=$false, Position=3)][string] $url = '',
[parameter(Mandatory=$false, Position=4)]
[alias("url64")][string] $url64bit = '',
Expand All @@ -230,6 +230,7 @@ param(
[alias("useOnlyPackageSilentArgs")][switch] $useOnlyPackageSilentArguments = $false,
[parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)
[string]$silentArgs = $silentArgs -join ' '

Write-Debug "Running 'Install-ChocolateyPackage' for $packageName with url:`'$url`', args: `'$silentArgs`', fileType: `'$fileType`', url64bit: `'$url64bit`', checksum: `'$checksum`', checksumType: `'$checksumType`', checksum64: `'$checksum64`', checksumType64: `'$checksumType64`', validExitCodes: `'$validExitCodes`' ";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,14 @@ Install-ChocolateyPackage
Install-ChocolateyInstallPackage
#>
param(
[parameter(Mandatory=$false, Position=0)][string] $statements,
[parameter(Mandatory=$false, Position=0)][string[]] $statements,
[parameter(Mandatory=$false, Position=1)][string] $exeToRun = 'powershell',
[parameter(Mandatory=$false)][switch] $minimized,
[parameter(Mandatory=$false)][switch] $noSleep,
[parameter(Mandatory=$false)] $validExitCodes = @(0),
[parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)
[statements]$statements = $statements -join ' '
Write-Debug "Running 'Start-ChocolateyProcessAsAdmin' with exeToRun:`'$exeToRun`', statements: `'$statements`' ";

$wrappedStatements = $statements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,13 @@ param(
[parameter(Mandatory=$true, Position=0)][string] $packageName,
[parameter(Mandatory=$false, Position=1)]
[alias("installerType")][string] $fileType = 'exe',
[parameter(Mandatory=$false, Position=2)][string] $silentArgs = '',
[parameter(Mandatory=$false, Position=2)][string[]] $silentArgs = '',
[parameter(Mandatory=$false, Position=3)][string] $file,
[parameter(Mandatory=$false)] $validExitCodes = @(0),
[parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)
[string]$silentArgs = $silentArgs -join ' '

Write-Debug "Running 'Uninstall-ChocolateyPackage' for $packageName with fileType:`'$fileType`', silentArgs: `'$silentArgs`', file: `'$file`'";

$installMessage = "Uninstalling $packageName..."
Expand Down

0 comments on commit d6c7fc8

Please sign in to comment.