#!/usr/bin/env nu # Thin entry for orchestrator commands. # Loads only commands/orchestration.nu. 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 { [] })) let _coerce = {|raw| $raw == "true" or $raw == "1" } let raw_no_titles = ($env.PROVISIONING_NO_TITLES? | default "") if ($raw_no_titles | describe) == "string" and ($raw_no_titles | is-not-empty) { $env.PROVISIONING_NO_TITLES = (do $_coerce $raw_no_titles) } let raw_debug = ($env.PROVISIONING_DEBUG? | default "") if ($raw_debug | describe) == "string" and ($raw_debug | is-not-empty) { $env.PROVISIONING_DEBUG = (do $_coerce $raw_debug) } } use main_provisioning/flags.nu [parse_common_flags] use main_provisioning/commands/orchestration.nu * def main [ ...args: string --infra (-i): string = "" --out: string = "" --debug (-x) --yes (-y) --check (-c) --notitles --verbose ]: nothing -> nothing { if $debug { $env.PROVISIONING_DEBUG = true } let cmd = ($args | get 0? | default "") let ops = ($args | skip 1 | str join " ") let flags = (parse_common_flags { debug: $debug, out: ($out | default ""), notitles: $notitles, infra: ($infra | default ""), yes: $yes, check: $check, verbose: $verbose }) handle_orchestration_command $cmd $ops $flags }