@@ -24,52 +24,52 @@ $usage_add = "usage: scoop bucket add <name> [<repo>]"
2424$usage_rm = " usage: scoop bucket rm <name>"
2525
2626function add_bucket ($name , $repo ) {
27- if (! $name ) { " <name> missing" ; $usage_add ; exit 1 }
28- if (! $repo ) {
29- $repo = known_bucket_repo $name
30- if (! $repo ) { " unknown bucket '$name ': try specifying <repo>" ; $usage_add ; exit 1 }
31- }
27+ if (! $name ) { " <name> missing" ; $usage_add ; exit 1 }
28+ if (! $repo ) {
29+ $repo = known_bucket_repo $name
30+ if (! $repo ) { " unknown bucket '$name ': try specifying <repo>" ; $usage_add ; exit 1 }
31+ }
3232
33- $git = try { gcm ' git' - ea stop } catch { $null }
34- if (! $git ) {
35- abort " git is required for buckets. run 'scoop install git'."
36- }
33+ $git = try { gcm ' git' - ea stop } catch { $null }
34+ if (! $git ) {
35+ abort " git is required for buckets. run 'scoop install git'."
36+ }
3737
38- $dir = bucketdir $name
39- if (test-path $dir ) {
40- abort " '$name ' bucket already exists. use 'scoop bucket rm $name ' to remove it."
41- }
38+ $dir = bucketdir $name
39+ if (test-path $dir ) {
40+ abort " '$name ' bucket already exists. use 'scoop bucket rm $name ' to remove it."
41+ }
4242
43- write-host ' checking repo...' - nonewline
44- git ls- remote $repo 2>&1 > $null
45- if ($lastexitcode -ne 0 ) {
46- abort " '$repo ' doesn't look like a valid git repository"
47- }
48- write-host ' ok'
43+ write-host ' checking repo...' - nonewline
44+ git ls- remote $repo 2>&1 > $null
45+ if ($lastexitcode -ne 0 ) {
46+ abort " '$repo ' doesn't look like a valid git repository"
47+ }
48+ write-host ' ok'
4949
50- ensure $bucketsdir > $null
51- $dir = ensure $dir
52- git clone " $repo " " $dir "
53- success " $name bucket was added successfully"
50+ ensure $bucketsdir > $null
51+ $dir = ensure $dir
52+ git clone " $repo " " $dir "
53+ success " $name bucket was added successfully"
5454}
5555
5656function rm_bucket ($name ) {
57- if (! $name ) { " <name> missing" ; $usage_rm ; exit 1 }
58- $dir = bucketdir $name
59- if (! (test-path $dir )) {
60- abort " '$name ' bucket not found"
61- }
57+ if (! $name ) { " <name> missing" ; $usage_rm ; exit 1 }
58+ $dir = bucketdir $name
59+ if (! (test-path $dir )) {
60+ abort " '$name ' bucket not found"
61+ }
6262
63- rm $dir - r - force - ea stop
63+ rm $dir - r - force - ea stop
6464}
6565
6666function list_buckets {
67- buckets
67+ buckets
6868}
6969
7070switch ($cmd ) {
71- " add" { add_bucket $name $repo }
72- " rm" { rm_bucket $name }
73- " list" { list_buckets }
74- default { " scoop bucket: cmd '$cmd ' not supported" ; my_usage; exit 1 }
71+ " add" { add_bucket $name $repo }
72+ " rm" { rm_bucket $name }
73+ " list" { list_buckets }
74+ default { " scoop bucket: cmd '$cmd ' not supported" ; my_usage; exit 1 }
7575}
0 commit comments