Skip to content

Commit f4f2b69

Browse files
HUMORCErashil2000
authored andcommitted
feat(scoop-bucket): List more detailed information for buckets (ScoopInstaller#4704)
* refactor(scoop-bucket): Show source/lastupdate for buckets * use `StartsWith` * CHANGELOG * punctuation * style * upd * Update libexec/scoop-bucket.ps1 Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com> * count num of manifests in the buckets * update changelog * remove write-host * friendly_path * datetime format * order * sty * prop. * trim * obj * update CHANGELOG Co-authored-by: Rashil Gandhi <46838874+rashil2000@users.noreply.github.com>
1 parent 35207e2 commit f4f2b69

2 files changed

Lines changed: 33 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
- **scoop-download:** Add `scoop download` command ([#4621](https://github.com/ScoopInstaller/Scoop/issues/4621))
77
- **scoop-(install|virustotal):** Allow skipping update check ([#4634](https://github.com/ScoopInstaller/Scoop/issues/4634))
8+
- **scoop-bucket:** List more detailed information for buckets ([#4704](https://github.com/ScoopInstaller/Scoop/pull/4704))
89

910
### Bug Fixes
1011

libexec/scoop-bucket.ps1

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,46 @@
1919
# scoop bucket known
2020
param($cmd, $name, $repo)
2121

22-
. "$psscriptroot\..\lib\core.ps1"
23-
. "$psscriptroot\..\lib\buckets.ps1"
24-
. "$psscriptroot\..\lib\help.ps1"
22+
. "$PSScriptRoot\..\lib\core.ps1"
23+
. "$PSScriptRoot\..\lib\buckets.ps1"
24+
. "$PSScriptRoot\..\lib\help.ps1"
2525

2626
reset_aliases
2727

2828
$usage_add = "usage: scoop bucket add <name> [<repo>]"
2929
$usage_rm = "usage: scoop bucket rm <name>"
3030

31-
switch($cmd) {
31+
function list_buckets {
32+
$buckets = @()
33+
34+
foreach ($bucket in Get-LocalBucket) {
35+
$source = Find-BucketDirectory $bucket -Root
36+
$manifests = (
37+
Get-ChildItem "$source\bucket" -Force -Recurse -ErrorAction SilentlyContinue |
38+
Measure-Object | Select-Object -ExpandProperty Count
39+
)
40+
$updated = 'N/A'
41+
if (Test-Path (Join-Path $source '.git')) {
42+
$updated = git_cmd -C "`"$source`"" log --date=format:"`"%Y-%m-%d %H:%M:%S`"" --format='%ad' -n 1
43+
$source = git_cmd -C "`"$source`"" config remote.origin.url
44+
} else {
45+
$updated = (Get-Item "$source\bucket").LastWriteTime | Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
46+
$source = friendly_path $source
47+
}
48+
$buckets += New-Object PSObject -Property @{
49+
Name = $bucket
50+
Source = $source
51+
Updated = $updated
52+
Manifests = $manifests
53+
}
54+
}
55+
return $buckets | Select-Object Name, Source, Updated, Manifests
56+
}
57+
58+
switch ($cmd) {
3259
'add' { add_bucket $name $repo }
3360
'rm' { rm_bucket $name }
34-
'list' { Get-LocalBucket }
61+
'list' { list_buckets }
3562
'known' { known_buckets }
3663
default { "scoop bucket: cmd '$cmd' not supported"; my_usage; exit 1 }
3764
}

0 commit comments

Comments
 (0)