Skip to content
This repository was archived by the owner on Sep 9, 2024. It is now read-only.

Commit 7382e17

Browse files
committed
convert spaces to tabs
1 parent 01fa31e commit 7382e17

17 files changed

+228
-227
lines changed

bin/install.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ iex (new-object net.webclient).downloadstring($core_url)
1111

1212
# prep
1313
if(installed 'scoop') {
14-
write-host "scoop is already installed. run 'scoop update' to get the latest version." -f red
15-
# don't abort if invoked with iex——that would close the PS session
16-
if($myinvocation.commandorigin -eq 'Internal') { return } else { exit 1 }
14+
write-host "scoop is already installed. run 'scoop update' to get the latest version." -f red
15+
# don't abort if invoked with iex——that would close the PS session
16+
if($myinvocation.commandorigin -eq 'Internal') { return } else { exit 1 }
1717
}
1818
$dir = ensure (versiondir 'scoop' 'current')
1919

bin/uninstall.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ if($yn -notlike 'y*') { exit }
99

1010
# run uninstallers if necessary
1111
installed_apps | % {
12-
$app = $_
13-
$version = current_version $app
14-
$dir = versiondir $app $version
15-
$manifest = installed_manifest $app $version
16-
$install = install_info $app $version
17-
$architecture = $install.architecture
12+
$app = $_
13+
$version = current_version $app
14+
$dir = versiondir $app $version
15+
$manifest = installed_manifest $app $version
16+
$install = install_info $app $version
17+
$architecture = $install.architecture
1818

19-
echo "uninstalling $app"
20-
run_uninstaller $manifest $architecture $dir
21-
rm_env_path $manifest $dir
22-
rm_env $manifest
19+
echo "uninstalling $app"
20+
run_uninstaller $manifest $architecture $dir
21+
rm_env_path $manifest $dir
22+
rm_env $manifest
2323
}
2424

2525
if(test-path $scoopdir) {

lib/buckets.ps1

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,53 @@
11
$bucketsdir = "$scoopdir\buckets"
22

33
function bucketdir($name) {
4-
if(!$name) { return relpath "..\bucket" } # main bucket
4+
if(!$name) { return relpath "..\bucket" } # main bucket
55

6-
"$bucketsdir\$name"
6+
"$bucketsdir\$name"
77
}
88

99
function known_bucket_repo($name) {
10-
$dir = versiondir 'scoop' 'current'
11-
$json = "$dir\buckets.json"
12-
$buckets = gc $json -raw | convertfrom-json -ea stop
13-
$buckets.$name
10+
$dir = versiondir 'scoop' 'current'
11+
$json = "$dir\buckets.json"
12+
$buckets = gc $json -raw | convertfrom-json -ea stop
13+
$buckets.$name
1414
}
1515

1616
function apps_in_bucket($dir) {
17-
gci $dir | ? { $_.name.endswith('.json') } | % { $_ -replace '.json$', '' }
17+
gci $dir | ? { $_.name.endswith('.json') } | % { $_ -replace '.json$', '' }
1818
}
1919

2020
function buckets {
21-
$buckets = @()
22-
if(test-path $bucketsdir) {
23-
gci $bucketsdir | % { $buckets += $_.name }
24-
}
25-
$buckets
21+
$buckets = @()
22+
if(test-path $bucketsdir) {
23+
gci $bucketsdir | % { $buckets += $_.name }
24+
}
25+
$buckets
2626
}
2727

2828
function find_manifest($app) {
29-
@($null) + @(buckets) | % { # null for main bucket
30-
$manifest = manifest $app $_
31-
if($manifest) { return $manifest, $_ }
32-
}
29+
@($null) + @(buckets) | % { # null for main bucket
30+
$manifest = manifest $app $_
31+
if($manifest) { return $manifest, $_ }
32+
}
3333
}
3434

3535
<#
3636
# convert an object to a hashtable
3737
function hashtable($obj) {
38-
$h = @{ }
39-
$obj.psobject.properties | % {
40-
$h[$_.name] = hashtable_val($_.value);
41-
}
42-
return $h
38+
$h = @{ }
39+
$obj.psobject.properties | % {
40+
$h[$_.name] = hashtable_val($_.value);
41+
}
42+
return $h
4343
}
4444
function hashtable_val($obj) {
45-
if($obj -is [object[]]) {
46-
return $_.value | % { hashtable_val($_) }
47-
}
48-
if($obj.gettype().name -eq 'pscustomobject') { # -is is unreliable
49-
return hashtable($obj)
50-
}
51-
return $obj # assume primitive
45+
if($obj -is [object[]]) {
46+
return $_.value | % { hashtable_val($_) }
47+
}
48+
if($obj.gettype().name -eq 'pscustomobject') { # -is is unreliable
49+
return hashtable($obj)
50+
}
51+
return $obj # assume primitive
5252
}
5353
#>

lib/commands.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function commands {
77
}
88

99
function command_name($filename) {
10-
$filename.name | sls 'scoop-(.*?)\.ps1$' | % { $_.matches[0].groups[1].value }
10+
$filename.name | sls 'scoop-(.*?)\.ps1$' | % { $_.matches[0].groups[1].value }
1111
}
1212

1313
function exec($cmd, $arguments) {

lib/decompress.ps1

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
function 7zip_installed {
2-
try { gcm 7z -ea stop } catch { return $false }
3-
$true
2+
try { gcm 7z -ea stop } catch { return $false }
3+
$true
44
}
55

66
function requires_7zip($fname) {
7-
$fname -match '(\.gz)|(\.tar)|(\.lzma)|(\.7z)$'
7+
$fname -match '(\.gz)|(\.tar)|(\.lzma)|(\.7z)$'
88
}
99

1010
function extract_7zip($path, $to, $recurse) {
11-
if(!$recurse) { write-host "extracting..." -nonewline }
12-
$output = 7z x "$path" -o"$to" -y
13-
if($lastexitcode -ne 0) { abort "exit code was $lastexitcode" }
11+
if(!$recurse) { write-host "extracting..." -nonewline }
12+
$output = 7z x "$path" -o"$to" -y
13+
if($lastexitcode -ne 0) { abort "exit code was $lastexitcode" }
1414

15-
# recursively extract files, e.g. for .tar.gz
16-
$output | sls '^Extracting\s+(.*)$' | % {
17-
$fname = $_.matches[0].groups[1].value
18-
if(requires_7zip $fname) { extract_7zip "$to\$fname" $to $true }
19-
}
15+
# recursively extract files, e.g. for .tar.gz
16+
$output | sls '^Extracting\s+(.*)$' | % {
17+
$fname = $_.matches[0].groups[1].value
18+
if(requires_7zip $fname) { extract_7zip "$to\$fname" $to $true }
19+
}
2020

21-
rm $path
22-
if(!$recurse) { write-host "done" }
21+
rm $path
22+
if(!$recurse) { write-host "done" }
2323
}

lib/help.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ function help($text) {
1212
}
1313

1414
function my_usage { # gets usage for the calling script
15-
usage (gc $myInvocation.PSCommandPath -raw)
15+
usage (gc $myInvocation.PSCommandPath -raw)
1616
}

lib/install.ps1

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,35 @@ function dl_progress($url, $to) {
1919

2020
$wc = new-object net.webclient
2121
register-objectevent $wc downloadprogresschanged progress | out-null
22-
register-objectevent $wc downloadfilecompleted complete | out-null
23-
try {
24-
$wc.downloadfileasync($url, $to)
25-
26-
function is_complete {
27-
try { get-event complete -ea stop; $true } catch { $false }
28-
}
29-
30-
$last_p = -1
31-
while(!(is_complete)) {
32-
$e = wait-event progress
33-
remove-event progress
34-
$p = $e.sourceeventargs.progresspercentage
35-
if($p -ne $last_p) {
36-
[console]::cursorleft = $left
37-
write-host "$p%" -nonewline
38-
$last_p = $p
39-
}
40-
}
41-
remove-event complete
42-
} finally {
43-
remove-event *
44-
unregister-event progress
45-
unregister-event complete
46-
47-
$wc.cancelasync()
48-
$wc.dispose()
49-
}
50-
[console]::cursorleft = $left
22+
register-objectevent $wc downloadfilecompleted complete | out-null
23+
try {
24+
$wc.downloadfileasync($url, $to)
25+
26+
function is_complete {
27+
try { get-event complete -ea stop; $true } catch { $false }
28+
}
29+
30+
$last_p = -1
31+
while(!(is_complete)) {
32+
$e = wait-event progress
33+
remove-event progress
34+
$p = $e.sourceeventargs.progresspercentage
35+
if($p -ne $last_p) {
36+
[console]::cursorleft = $left
37+
write-host "$p%" -nonewline
38+
$last_p = $p
39+
}
40+
}
41+
remove-event complete
42+
} finally {
43+
remove-event *
44+
unregister-event progress
45+
unregister-event complete
46+
47+
$wc.cancelasync()
48+
$wc.dispose()
49+
}
50+
[console]::cursorleft = $left
5151
}
5252

5353
function dl_urls($app, $version, $manifest, $architecture, $dir) {

libexec/scoop-bucket.ps1

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -24,52 +24,52 @@ $usage_add = "usage: scoop bucket add <name> [<repo>]"
2424
$usage_rm = "usage: scoop bucket rm <name>"
2525

2626
function 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

5656
function 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

6666
function list_buckets {
67-
buckets
67+
buckets
6868
}
6969

7070
switch($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
}

libexec/scoop-cache.ps1

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ param($cmd, $app)
55
. "$psscriptroot\..\lib\help.ps1"
66

77
switch($cmd) {
8-
'rm' {
9-
if(!$app) { 'ERROR: <app> missing'; my_usage; exit 1 }
10-
rm "$scoopdir\cache\$app#*"
11-
}
12-
'show' {
13-
gci "$scoopdir\cache" | select name
14-
}
15-
default {
16-
"cache '$cmd' not supported"; my_usage; exit 1
17-
}
8+
'rm' {
9+
if(!$app) { 'ERROR: <app> missing'; my_usage; exit 1 }
10+
rm "$scoopdir\cache\$app#*"
11+
}
12+
'show' {
13+
gci "$scoopdir\cache" | select name
14+
}
15+
default {
16+
"cache '$cmd' not supported"; my_usage; exit 1
17+
}
1818
}
1919

2020
exit 0

0 commit comments

Comments
 (0)