2025-09-22 22:11:41 +00:00
|
|
|
export def parse_help_command [
|
|
|
|
source: string
|
|
|
|
name?: string
|
|
|
|
--task: closure
|
|
|
|
--ismod
|
|
|
|
--end
|
|
|
|
] {
|
|
|
|
#use utils/interface.nu end_run
|
2025-09-22 23:00:01 +00:00
|
|
|
let args = ($env.PROVISIONING_ARGS? | default "")
|
2025-09-22 22:11:41 +00:00
|
|
|
let has_help = if ($args | str contains "help") or ($args |str ends-with " h") {
|
|
|
|
true
|
|
|
|
} else if $name != null and $name == "help" or $name == "h" {
|
|
|
|
true
|
|
|
|
} else { false }
|
|
|
|
if not $has_help { return }
|
|
|
|
let mod_str = if $ismod { "-mod" } else { "" }
|
|
|
|
^$env.PROVISIONING_NAME $mod_str ...($source | split row " ") --help
|
|
|
|
if $task != null { do $task }
|
|
|
|
if $end {
|
|
|
|
if not $env.PROVISIONING_DEBUG { end_run "" }
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
}
|