mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-12-09 17:45:39 +00:00
44 lines
1009 B
PowerShell
44 lines
1009 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
|
|
$summary = summary $file
|
|
$help = scoop_help $file
|
|
|
|
if($usage) { "$usage`n" }
|
|
if($help) { $help }
|
|
}
|
|
|
|
function print_summaries {
|
|
$commands = @{}
|
|
|
|
command_files | ForEach-Object {
|
|
$command = command_name $_
|
|
$summary = summary (Get-Content (command_path $command) -raw)
|
|
if(!($summary)) { $summary = '' }
|
|
$commands.add("$command ", $summary) # add padding
|
|
}
|
|
|
|
$commands.getenumerator() | Sort-Object name | Format-Table -hidetablehead -autosize -wrap
|
|
}
|
|
|
|
$commands = commands
|
|
|
|
if(!($cmd)) {
|
|
"Usage: scoop <command> [<args>]
|
|
|
|
Some useful commands are:"
|
|
print_summaries
|
|
"Type 'scoop help <command>' to get help for a specific command."
|
|
} elseif($commands -contains $cmd) {
|
|
print_help $cmd
|
|
} else {
|
|
"scoop help: no such command '$cmd'"; exit 1
|
|
}
|
|
|
|
exit 0
|