diff --git a/cli/provisioning b/cli/provisioning index 5f260f9..6c050b6 100755 --- a/cli/provisioning +++ b/cli/provisioning @@ -1055,8 +1055,8 @@ else workspace | ws) $NU "${NU_ARGS[@]}" "$PROVISIONING/core/nulib/main_provisioning/workspace.nu" $CMD_ARGS 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_authentication_command $cmd $ops $flags +} diff --git a/nulib/provisioning-build.nu b/nulib/provisioning-build.nu new file mode 100644 index 0000000..dd897ec --- /dev/null +++ b/nulib/provisioning-build.nu @@ -0,0 +1,48 @@ +#!/usr/bin/env nu +# Thin entry for build commands. +# Loads only commands/build.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/build.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_build_command $cmd $ops $flags +} diff --git a/nulib/provisioning-config.nu b/nulib/provisioning-config.nu new file mode 100644 index 0000000..6343a58 --- /dev/null +++ b/nulib/provisioning-config.nu @@ -0,0 +1,48 @@ +#!/usr/bin/env nu +# Thin entry for validate | env | show | config commands. +# Loads only commands/configuration.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/configuration.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_configuration_command $cmd $ops $flags +} diff --git a/nulib/provisioning-delete.nu b/nulib/provisioning-delete.nu new file mode 100644 index 0000000..a41d2c6 --- /dev/null +++ b/nulib/provisioning-delete.nu @@ -0,0 +1,42 @@ +#!/usr/bin/env nu +# Thin entry for delete commands (server, taskserv, cluster). +# Loads only main_provisioning/delete.nu (~45ms vs ~3s for cli.nu fallback). + +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/delete.nu * + +def main [ + ...args: string + --infra (-i): string = "" + --yes (-y) + --debug (-x) + --keepstorage + --notitles + --wait (-w) + --settings (-s): string = "" +]: nothing -> nothing { + if $debug { $env.PROVISIONING_DEBUG = true } + let target = ($args | get 0? | default "") + let name = ($args | get 1? | default "") + main delete $target $name --infra $infra --yes=$yes --keepstorage=$keepstorage --notitles=$notitles --wait=$wait --settings $settings +} diff --git a/nulib/provisioning-dev.nu b/nulib/provisioning-dev.nu new file mode 100644 index 0000000..7463561 --- /dev/null +++ b/nulib/provisioning-dev.nu @@ -0,0 +1,48 @@ +#!/usr/bin/env nu +# Thin entry for module | layer | discover commands. +# Loads only commands/development.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/development.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_development_command $cmd $ops $flags +} diff --git a/nulib/provisioning-guide.nu b/nulib/provisioning-guide.nu new file mode 100644 index 0000000..b81546e --- /dev/null +++ b/nulib/provisioning-guide.nu @@ -0,0 +1,48 @@ +#!/usr/bin/env nu +# Thin entry for guide | shortcuts | quickstart commands. +# Loads only commands/guides.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/guides.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_guide_command $cmd $ops $flags +} diff --git a/nulib/provisioning-orchestrator.nu b/nulib/provisioning-orchestrator.nu new file mode 100644 index 0000000..0b2282a --- /dev/null +++ b/nulib/provisioning-orchestrator.nu @@ -0,0 +1,48 @@ +#!/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 +} diff --git a/nulib/provisioning-vm.nu b/nulib/provisioning-vm.nu new file mode 100644 index 0000000..d194843 --- /dev/null +++ b/nulib/provisioning-vm.nu @@ -0,0 +1,48 @@ +#!/usr/bin/env nu +# Thin entry for vm commands. +# Loads only commands/vm_domain.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/vm_domain.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_vm_command $cmd $ops $flags +}