41 lines
1.2 KiB
Text
41 lines
1.2 KiB
Text
|
|
#!/usr/bin/env nu
|
||
|
|
# Thin entry for status | health | diagnostics commands.
|
||
|
|
# Loads ONLY diagnostics modules (~100ms vs ~9s for the full entry).
|
||
|
|
|
||
|
|
export-env {
|
||
|
|
let lib_dirs_raw = ($env.NU_LIB_DIRS? | default "")
|
||
|
|
let current_lib_dirs = if ($lib_dirs_raw | type) == "string" {
|
||
|
|
if ($lib_dirs_raw | is-empty) { [] } else { ($lib_dirs_raw | split row ":") }
|
||
|
|
} else {
|
||
|
|
$lib_dirs_raw
|
||
|
|
}
|
||
|
|
let dynamic = ($env.PROVISIONING? | default "" | path join "core" "nulib")
|
||
|
|
$env.NU_LIB_DIRS = ([
|
||
|
|
"/opt/provisioning/core/nulib"
|
||
|
|
"/usr/local/provisioning/core/nulib"
|
||
|
|
] | append $current_lib_dirs | append (if ($dynamic | is-not-empty) { [$dynamic] } else { [] }))
|
||
|
|
}
|
||
|
|
|
||
|
|
use main_provisioning/commands/diagnostics.nu *
|
||
|
|
use main_provisioning/flags.nu *
|
||
|
|
|
||
|
|
def main [
|
||
|
|
...args: string
|
||
|
|
--out: string
|
||
|
|
--debug (-x)
|
||
|
|
--notitles
|
||
|
|
]: nothing -> nothing {
|
||
|
|
if $debug { $env.PROVISIONING_DEBUG = true }
|
||
|
|
|
||
|
|
let cmd = ($args | get 0? | default "status")
|
||
|
|
let ops = ($args | skip 1 | str join " ")
|
||
|
|
|
||
|
|
let flags = (parse_common_flags {
|
||
|
|
debug: $debug
|
||
|
|
out: ($out | default "")
|
||
|
|
notitles: $notitles
|
||
|
|
})
|
||
|
|
|
||
|
|
handle_diagnostics_command $cmd $ops $flags
|
||
|
|
}
|