11# Requires -Version 5
2- param ([string ] $cmd )
2+ param ([String ] $Command )
33
44Set-StrictMode - Off
55
@@ -17,32 +17,34 @@ Upgrade PowerShell: 'https://docs.microsoft.com/en-us/powershell/scripting/insta
1717
1818Reset-Alias
1919
20- $exitCode = 0
20+ $ExitCode = 0
2121
22- # Powershell automatically bind bash like short parameters as $args, and does not put it in $cmd parameter
22+ # Powershell automatically bind bash like short parameters as $args, and does not put it in $Command parameter
2323# ONLY if:
2424# - No command passed
2525# - -v or --version passed
26- $version = ($cmd -eq ' --version' ) -or (! $cmd -and ($args.Contains (' -v' )))
26+ $version = ($Command -eq ' --version' ) -or (! $Command -and ($args.Contains (' -v' )))
2727
2828# Scoop itself help should be shown only if explicitly asked:
2929# - No version asked
3030# - No command passed
3131# - /?, /help,, /h, --help, -h passed
32- $scoopHelp = ! $version -and (! $cmd -or (($cmd -in @ ($null , ' --help' , ' /?' , ' /help' , ' /h' )) -or (! $cmd -and ($args.Contains (' -h' )))))
32+ $scoopHelp = ! $version -and (! $Command -or (($Command -in @ ($null , ' --help' , ' /?' , ' /help' , ' /h' )) -or (! $Command -and ($args.Contains (' -h' )))))
3333
3434# Valid command execution
35- $validCommand = $cmd -and ($cmd -in (commands))
35+ $validCommand = $Command -and ($Command -in (commands))
3636
3737# Command help should be shown only if:
3838# - No help for scoop asked
39- # - $cmd is passed
39+ # - $Command is passed
4040# - --help, -h is in $args
4141$commandHelp = ! $scoopHelp -and $validCommand -and (($args.Contains (' --help' )) -or ($args.Contains (' -h' )))
4242
4343if ($version ) {
44- Write-UserMessage - Message " PowerShell version: $ ( $PSVersionTable.PSVersion ) " - Output
45- Write-UserMessage - Message ' Current Scoop (Shovel) version:' - Output
44+ Write-UserMessage - Output - Message @ (
45+ " PowerShell version: $ ( $PSVersionTable.PSVersion ) "
46+ ' Current Scoop (Shovel) version:'
47+ )
4648 Invoke-GitCmd - Command ' VersionLog' - Repository (versiondir ' scoop' ' current' )
4749
4850 # TODO: Export to lib/buckets
@@ -57,18 +59,16 @@ if ($version) {
5759 }
5860} elseif ($scoopHelp ) {
5961 Invoke-ScoopCommand ' help'
60- $exitCode = $LASTEXITCODE
62+ $ExitCode = $LASTEXITCODE
6163} elseif ($commandHelp ) {
62- # TODO: getopt adoption
63- # Invoke-ScoopCommand 'help' @($cmd)
64- Invoke-ScoopCommand ' help' @ { ' cmd' = $cmd }
65- $exitCode = $LASTEXITCODE
64+ Invoke-ScoopCommand ' help' @ ($Command )
65+ $ExitCode = $LASTEXITCODE
6666} elseif ($validCommand ) {
67- Invoke-ScoopCommand $cmd $args
68- $exitCode = $LASTEXITCODE
67+ Invoke-ScoopCommand $Command $args
68+ $ExitCode = $LASTEXITCODE
6969} else {
70- Write-UserMessage - Message " scoop: '$cmd ' isn't a scoop command. See 'scoop help'." - Output
71- $exitCode = 2
70+ Write-UserMessage - Message " scoop: '$Command ' isn't a scoop command. See 'scoop help'." - Output
71+ $ExitCode = 2
7272}
7373
74- exit $exitCode
74+ exit $ExitCode
0 commit comments