mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-10-30 06:07:56 +00:00
* tweaks to help system * update help text * update changelog * fix order of printing deps * Apply suggestions from code review Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com> * Update scoop-help.ps1 * Update scoop.ps1 Co-authored-by: Hsiao-nan Cheung <niheaven@gmail.com>
45 lines
927 B
PowerShell
45 lines
927 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 {
|
|
warn "scoop help: no such command '$cmd'"
|
|
exit 1
|
|
}
|
|
|
|
exit 0
|