Files
Scoop/lib/help.ps1
Eric Bouchard 78d2ff75f4 fix(help): Rename help() to scoop_help() (#3564)
When a user has an alias named `help`, the `scoop help` command does not work anymore.
To prevent collision with a user alias the function is renamed from `help` to `scoop_help`
2019-07-18 18:33:22 +02:00

17 lines
585 B
PowerShell

function usage($text) {
$text | Select-String '(?m)^# Usage: ([^\n]*)$' | ForEach-Object { "Usage: " + $_.matches[0].groups[1].value }
}
function summary($text) {
$text | Select-String '(?m)^# Summary: ([^\n]*)$' | ForEach-Object { $_.matches[0].groups[1].value }
}
function scoop_help($text) {
$help_lines = $text | Select-String '(?ms)^# Help:(.(?!^[^#]))*' | ForEach-Object { $_.matches[0].value; }
$help_lines -replace '(?ms)^#\s?(Help: )?', ''
}
function my_usage { # gets usage for the calling script
usage (Get-Content $myInvocation.PSCommandPath -raw)
}