#!/usr/bin/env nu # Thin entry for bootstrap command (~94ms vs ~9s through the full dispatcher). 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 orchestration/bootstrap.nu * def main [ subcommand?: string # Optional: sync-firewall, sync-alias-ips --workspace (-w): string --dry-run (-n) --debug (-x) ]: nothing -> nothing { if $debug { $env.PROVISIONING_DEBUG = true } let ws = ($workspace | default "") match $subcommand { "sync-firewall" => { if $dry_run { if ($ws | is-not-empty) { main bootstrap sync-firewall --workspace $ws --dry-run } else { main bootstrap sync-firewall --dry-run } } else { if ($ws | is-not-empty) { main bootstrap sync-firewall --workspace $ws } else { main bootstrap sync-firewall } } } "sync-alias-ips" => { if $dry_run { if ($ws | is-not-empty) { main bootstrap sync-alias-ips --workspace $ws --dry-run } else { main bootstrap sync-alias-ips --dry-run } } else { if ($ws | is-not-empty) { main bootstrap sync-alias-ips --workspace $ws } else { main bootstrap sync-alias-ips } } } null | "" => { if $dry_run { if ($ws | is-not-empty) { main bootstrap --workspace $ws --dry-run } else { main bootstrap --dry-run } } else { if ($ws | is-not-empty) { main bootstrap --workspace $ws } else { main bootstrap } } } _ => { error make { msg: $"Unknown subcommand '($subcommand)'. Available: sync-firewall, sync-alias-ips" } } } }