# Usage: scoop help # 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 [] Some useful commands are:" print_summaries "Type 'scoop help ' 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