mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-10-30 14:17:54 +00:00
fix(scoop): Pass CLI arguments as string objects (#4931)
Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com>
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
- **bucket:** Don't check remote URL of non-git buckets ([#4923](https://github.com/ScoopInstaller/Scoop/issues/4923))
|
- **bucket:** Don't check remote URL of non-git buckets ([#4923](https://github.com/ScoopInstaller/Scoop/issues/4923))
|
||||||
- **bucket:** Don't write message OK before bucket is cloned ([#4925](https://github.com/ScoopInstaller/Scoop/issues/4925))
|
- **bucket:** Don't write message OK before bucket is cloned ([#4925](https://github.com/ScoopInstaller/Scoop/issues/4925))
|
||||||
- **shim:** Remove character replacement in .cmd -> .ps1 shims ([#4914](https://github.com/ScoopInstaller/Scoop/issues/4914))
|
- **shim:** Remove character replacement in .cmd -> .ps1 shims ([#4914](https://github.com/ScoopInstaller/Scoop/issues/4914))
|
||||||
|
- **scoop:** Pass CLI arguments as string objects ([#4931](https://github.com/ScoopInstaller/Scoop/issues/4931))
|
||||||
- **scoop-info:** Fix error message when manifest is not found ([#4935](https://github.com/ScoopInstaller/Scoop/issues/4935))
|
- **scoop-info:** Fix error message when manifest is not found ([#4935](https://github.com/ScoopInstaller/Scoop/issues/4935))
|
||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
#Requires -Version 5
|
#Requires -Version 5
|
||||||
param($SubCommand)
|
|
||||||
|
|
||||||
Set-StrictMode -Off
|
Set-StrictMode -Off
|
||||||
|
|
||||||
. "$PSScriptRoot\..\lib\core.ps1"
|
. "$PSScriptRoot\..\lib\core.ps1"
|
||||||
@@ -8,21 +6,19 @@ Set-StrictMode -Off
|
|||||||
. "$PSScriptRoot\..\lib\commands.ps1"
|
. "$PSScriptRoot\..\lib\commands.ps1"
|
||||||
. "$PSScriptRoot\..\lib\help.ps1"
|
. "$PSScriptRoot\..\lib\help.ps1"
|
||||||
|
|
||||||
|
$subCommand = $Args[0]
|
||||||
|
|
||||||
# for aliases where there's a local function, re-alias so the function takes precedence
|
# for aliases where there's a local function, re-alias so the function takes precedence
|
||||||
$aliases = Get-Alias | Where-Object { $_.Options -notmatch 'ReadOnly|AllScope' } | ForEach-Object { $_.Name }
|
$aliases = Get-Alias | Where-Object { $_.Options -notmatch 'ReadOnly|AllScope' } | ForEach-Object { $_.Name }
|
||||||
Get-ChildItem Function: | Where-Object -Property Name -In -Value $aliases | ForEach-Object {
|
Get-ChildItem Function: | Where-Object -Property Name -In -Value $aliases | ForEach-Object {
|
||||||
Set-Alias -Name $_.Name -Value Local:$($_.Name) -Scope Script
|
Set-Alias -Name $_.Name -Value Local:$($_.Name) -Scope Script
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($SubCommand) {
|
switch ($subCommand) {
|
||||||
({ $SubCommand -in @($null, '--help', '/?') }) {
|
({ $subCommand -in @($null, '-h', '--help', '/?') }) {
|
||||||
if (!$SubCommand -and $Args -eq '-v') {
|
exec 'help'
|
||||||
$SubCommand = '--version'
|
|
||||||
} else {
|
|
||||||
exec 'help'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
({ $SubCommand -eq '--version' }) {
|
({ $subCommand -in @('-v', '--version') }) {
|
||||||
Write-Host 'Current Scoop version:'
|
Write-Host 'Current Scoop version:'
|
||||||
if ((Test-CommandAvailable git) -and (Test-Path "$PSScriptRoot\..\.git") -and (get_config SCOOP_BRANCH 'master') -ne 'master') {
|
if ((Test-CommandAvailable git) -and (Test-Path "$PSScriptRoot\..\.git") -and (get_config SCOOP_BRANCH 'master') -ne 'master') {
|
||||||
Invoke-Expression "git -C '$PSScriptRoot\..' --no-pager log --oneline HEAD -n 1"
|
Invoke-Expression "git -C '$PSScriptRoot\..' --no-pager log --oneline HEAD -n 1"
|
||||||
@@ -35,22 +31,23 @@ switch ($SubCommand) {
|
|||||||
|
|
||||||
Get-LocalBucket | ForEach-Object {
|
Get-LocalBucket | ForEach-Object {
|
||||||
$bucketLoc = Find-BucketDirectory $_ -Root
|
$bucketLoc = Find-BucketDirectory $_ -Root
|
||||||
if ((Test-Path (Join-Path $bucketLoc '.git')) -and (Test-CommandAvailable git)) {
|
if ((Test-Path "$bucketLoc\.git") -and (Test-CommandAvailable git)) {
|
||||||
Write-Host "'$_' bucket:"
|
Write-Host "'$_' bucket:"
|
||||||
Invoke-Expression "git -C '$bucketLoc' --no-pager log --oneline HEAD -n 1"
|
Invoke-Expression "git -C '$bucketLoc' --no-pager log --oneline HEAD -n 1"
|
||||||
Write-Host ''
|
Write-Host ''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
({ $SubCommand -in (commands) }) {
|
({ $subCommand -in (commands) }) {
|
||||||
if ($Args -in @('-h', '--help', '/?')) {
|
[string[]]$arguments = $Args | Select-Object -Skip 1
|
||||||
exec 'help' @($SubCommand)
|
if ($null -ne $arguments -and $arguments[0] -in @('-h', '--help', '/?')) {
|
||||||
|
exec 'help' @($subCommand)
|
||||||
} else {
|
} else {
|
||||||
exec $SubCommand $Args
|
exec $subCommand $arguments
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default {
|
default {
|
||||||
"scoop: '$SubCommand' isn't a scoop command. See 'scoop help'."
|
"scoop: '$subCommand' isn't a scoop command. See 'scoop help'."
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user