Files
Scoop/libexec/scoop-help.ps1
Roy Ivy III 6d9bca805f whitespace cleanup
* makes changes to almost all main repo files to be in accordance with .editorconfig
* some files in "test\fixtures\..." were left alone to avoid breaking tests
* NOTE: whitespace changes *only* (`git diff -b` shows no changes)
2015-08-17 22:54:43 -05:00

51 lines
1.1 KiB
PowerShell

# Usage: scoop help <command>
# Summary: Show help for a command
param($cmd)
. "$psscriptroot\..\lib\core.ps1"
. "$psscriptroot\..\lib\commands.ps1"
. "$psscriptroot\..\lib\help.ps1"
reset_aliases
function print_help($cmd) {
$file = gc (command_path $cmd) -raw
$usage = usage $file
$summary = summary $file
$help = help $file
if($usage) { "$usage`n" }
if($help) { $help }
}
function print_summaries {
$commands = @{}
command_files | % {
$command = command_name $_
$summary = summary (gc (command_path $command) -raw)
if(!($summary)) { $summary = '' }
$commands.add("$command ", $summary) # add padding
}
$commands.getenumerator() | sort name | ft -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