prvng_core/nulib/lib_provisioning/utils/help.nu

26 lines
710 B
Text
Raw Normal View History

# config/accessor star-import was dead — dropped (ADR-025 Phase 3 Layer 2).
2025-10-07 10:32:04 +01:00
export def parse_help_command [
source: string
name?: string
--task: closure
--ismod
--end
] {
#use utils/interface.nu end_run
let args = ($env.PROVISIONING_ARGS? | default "")
let has_help = if ($args | str contains "help") or ($args |str ends-with " h") {
2025-10-07 10:32:04 +01:00
true
} else if $name != null and $name == "help" or $name == "h" {
2025-10-07 10:32:04 +01:00
true
} else { false }
if not $has_help { return }
2025-10-07 10:32:04 +01:00
let mod_str = if $ismod { "-mod" } else { "" }
^(get-provisioning-name) $mod_str ...($source | split row " ") --help
if $task != null { do $task }
if $end {
if not (is-debug-enabled) { end_run "" }
2025-10-07 10:32:04 +01:00
exit
}
2025-10-07 10:32:04 +01:00
}