-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(scoop): Load libs only once (#4839)
- Loading branch information
Showing
42 changed files
with
145 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,56 @@ | ||
#Requires -Version 5 | ||
param($cmd) | ||
param($SubCommand) | ||
|
||
Set-StrictMode -off | ||
Set-StrictMode -Off | ||
|
||
. "$PSScriptRoot\..\lib\core.ps1" | ||
. "$PSScriptRoot\..\lib\buckets.ps1" | ||
. "$PSScriptRoot\..\lib\commands.ps1" | ||
. "$PSScriptRoot\..\lib\help.ps1" | ||
|
||
# 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 } | ||
Get-ChildItem Function: | Where-Object -Property Name -In -Value $aliases | ForEach-Object { | ||
Set-Alias -Name $_.Name -Value Local:$($_.Name) -Scope Script | ||
} | ||
|
||
$commands = commands | ||
if ('--version' -contains $cmd -or (!$cmd -and '-v' -contains $args)) { | ||
Write-Host "Current Scoop version:" | ||
Invoke-Expression "git -C '$(versiondir 'scoop' 'current')' --no-pager log --oneline HEAD -n 1" | ||
Write-Host "" | ||
switch ($SubCommand) { | ||
({ $SubCommand -in @($null, '--help', '/?') }) { | ||
if (!$SubCommand -and $Args -eq '-v') { | ||
$SubCommand = '--version' | ||
} else { | ||
exec 'help' | ||
} | ||
} | ||
({ $SubCommand -eq '--version' }) { | ||
Write-Host 'Current Scoop version:' | ||
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" | ||
} else { | ||
$version = Select-String -Pattern '^## \[(v[\d.]+)\].*?([\d-]+)$' -Path "$PSScriptRoot\..\CHANGELOG.md" | ||
Write-Host $version.Matches.Groups[1].Value -ForegroundColor Cyan -NoNewline | ||
Write-Host " - Released at $($version.Matches.Groups[2].Value)" | ||
} | ||
Write-Host '' | ||
|
||
Get-LocalBucket | ForEach-Object { | ||
$bucketLoc = Find-BucketDirectory $_ -Root | ||
if(Test-Path (Join-Path $bucketLoc '.git')) { | ||
Write-Host "'$_' bucket:" | ||
Invoke-Expression "git -C '$bucketLoc' --no-pager log --oneline HEAD -n 1" | ||
Write-Host "" | ||
Get-LocalBucket | ForEach-Object { | ||
$bucketLoc = Find-BucketDirectory $_ -Root | ||
if ((Test-Path (Join-Path $bucketLoc '.git')) -and (Test-CommandAvailable git)) { | ||
Write-Host "'$_' bucket:" | ||
Invoke-Expression "git -C '$bucketLoc' --no-pager log --oneline HEAD -n 1" | ||
Write-Host '' | ||
} | ||
} | ||
} | ||
({ $SubCommand -in (commands) }) { | ||
if ($Args -in @('-h', '--help', '/?')) { | ||
exec 'help' @($SubCommand) | ||
} else { | ||
exec $SubCommand $Args | ||
} | ||
} | ||
default { | ||
"scoop: '$SubCommand' isn't a scoop command. See 'scoop help'." | ||
exit 1 | ||
} | ||
} | ||
elseif (@($null, '--help', '/?') -contains $cmd -or $args[0] -contains '-h') { exec 'help' $args } | ||
elseif ($commands -contains $cmd) { exec $cmd $args } | ||
else { "scoop: '$cmd' isn't a scoop command. See 'scoop help'."; exit 1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
. "$PSScriptRoot\core.ps1" | ||
|
||
$bucketsdir = "$scoopdir\buckets" | ||
|
||
function Find-BucketDirectory { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.