mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-12-12 02:56:03 +00:00
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`
17 lines
585 B
PowerShell
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)
|
|
}
|