forked from ScoopInstaller/Scoop
-
Notifications
You must be signed in to change notification settings - Fork 11
/
scoop-prefix.ps1
35 lines (27 loc) · 1.05 KB
/
scoop-prefix.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Usage: scoop prefix [<OPTIONS>] <APP>
# Summary: Return the location/path of installed application.
#
# Options:
# -h, --help Show help for this command.
'core', 'buckets', 'getopt', 'help', 'Helpers', 'manifest' | ForEach-Object {
. (Join-Path $PSScriptRoot "..\lib\$_.ps1")
}
Reset-Alias
$ExitCode = 0
$Options, $Application, $_err = getopt $args
if ($_err) { Stop-ScoopExecution -Message "scoop prefix: $_err" -ExitCode 2 }
if (!$Application) { Stop-ScoopExecution -Message 'Parameter <APP> missing' -Usage (my_usage) }
# TODO: Test if application is installed first
# Same flow as for hold/unhold
# TODO: Add --global
# TODO: Respect NO_JUNCTIONS
$Application = $Application[0]
$ApplicationPath = versiondir $Application 'current' $false
if (!(Test-Path $ApplicationPath)) { $ApplicationPath = versiondir $Application 'current' $true }
if (Test-Path $ApplicationPath) {
Write-UserMessage -Message $ApplicationPath -Output
} else {
Write-UserMessage -Message "'$Application' is not installed" -Err
$ExitCode = 3
}
exit $ExitCode