mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-12-11 10:35:44 +00:00
45 lines
930 B
PowerShell
45 lines
930 B
PowerShell
# Usage: scoop help <command>
|
|
# Summary: Show help for a command
|
|
param($cmd)
|
|
|
|
function print_help($cmd) {
|
|
$file = Get-Content (command_path $cmd) -Raw
|
|
|
|
$usage = usage $file
|
|
$help = scoop_help $file
|
|
|
|
if ($usage) { "$usage`n" }
|
|
if ($help) { $help }
|
|
}
|
|
|
|
function print_summaries {
|
|
$commands = @()
|
|
|
|
command_files | ForEach-Object {
|
|
$command = [ordered]@{}
|
|
$command.Command = command_name $_
|
|
$command.Summary = summary (Get-Content (command_path $command.Command))
|
|
$commands += [PSCustomObject]$command
|
|
}
|
|
|
|
$commands
|
|
}
|
|
|
|
$commands = commands
|
|
|
|
if (!($cmd)) {
|
|
Write-Host "Usage: scoop <command> [<args>]
|
|
|
|
Available commands are listed below.
|
|
|
|
Type 'scoop help <command>' to get more help for a specific command."
|
|
print_summaries
|
|
} elseif ($commands -contains $cmd) {
|
|
print_help $cmd
|
|
} else {
|
|
error "scoop help: no such command '$cmd'"
|
|
exit 1
|
|
}
|
|
|
|
exit 0
|