forked from ScoopInstaller/Scoop
-
Notifications
You must be signed in to change notification settings - Fork 11
/
scoop-depends.ps1
36 lines (29 loc) · 1.26 KB
/
scoop-depends.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
36
# Usage: scoop depends [<OPTIONS>] <APP>
# Summary: List dependencies for an application.
#
# Options:
# -h, --help Show help for this command.
# -a, --arch <32bit|64bit|arm64> Use the specified architecture, if the application's manifest supports it.
@(
@('core', 'Test-ScoopDebugEnabled'),
@('getopt', 'Resolve-GetOpt'),
@('help', 'scoop_help'),
@('Helpers', 'New-IssuePrompt'),
@('depends', 'script_deps')
) | ForEach-Object {
if (!([bool] (Get-Command $_[1] -ErrorAction 'Ignore'))) {
Write-Verbose "Import of lib '$($_[0])' initiated from '$PSCommandPath'"
. (Join-Path $PSScriptRoot "..\lib\$($_[0]).ps1")
}
}
$ExitCode = 0
$Options, $Applications, $_err = Resolve-GetOpt $args 'a:' 'arch='
if ($_err) { Stop-ScoopExecution -Message "scoop depends: $_err" -ExitCode 2 }
# TODO: Multiple apps?
$Application = $Applications[0]
$Architecture = Resolve-ArchitectureParameter -Architecture $Options.a, $Options.arch
if (!$Application) { Stop-ScoopExecution -Message 'Parameter <APP> missing' -Usage (my_usage) }
# TODO: Installed dependencies are not listed. Should they be shown??
$deps = @(deps $Application $Architecture)
if ($deps) { $deps[($deps.Length - 1)..0] | Write-UserMessage -Output }
exit $ExitCode