fix(cli): dispatcher rename + provisioning-cli.nu bool coercion

This commit is contained in:
Jesús Pérez 2026-04-17 22:14:40 +01:00
parent 889feeb37c
commit 6df65b5096
Signed by: jesus
GPG key ID: 9F243E355E0BC939
2 changed files with 22 additions and 3 deletions

View file

@ -53,7 +53,7 @@ def _dispatch_workspace [cmd: string, ops: string, flags: record] {
}
def _dispatch_config [cmd: string, ops: string, flags: record] {
use commands/configuration.nu *
handle_config_command $cmd $ops $flags
handle_configuration_command $cmd $ops $flags
}
def _dispatch_utilities [cmd: string, ops: string, flags: record] {
use commands/utilities/mod.nu *

View file

@ -31,6 +31,25 @@ export-env {
if ( (version).installed_plugins | str contains "tera" ) {
(plugin use tera)
}
# Bash exports booleans as strings — normalize before any module code runs.
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_no_terminal = ($env.PROVISIONING_NO_TERMINAL? | default "")
if ($raw_no_terminal | describe) == "string" and ($raw_no_terminal | is-not-empty) {
$env.PROVISIONING_NO_TERMINAL = (do $_coerce $raw_no_terminal)
}
let raw_titles_shown = ($env.PROVISIONING_TITLES_SHOWN? | default "")
if ($raw_titles_shown | describe) == "string" and ($raw_titles_shown | is-not-empty) {
$env.PROVISIONING_TITLES_SHOWN = (do $_coerce $raw_titles_shown)
}
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)
}
}
# ADR-025 Phase 4 perf insight: Nushell selective imports (`use x [sym]`) still
@ -56,7 +75,7 @@ export def "main help" [
if ($out | is-not-empty) { $env.PROVISIONING_NO_TERMINAL = false }
let category = if ($args | length) > 0 { ($args | get 0) } else { "" }
print (provisioning_options $category)
if not $env.PROVISIONING_DEBUG { end_run "" }
if not ($env.PROVISIONING_DEBUG? | default false) { end_run "" }
}
def main [
@ -249,7 +268,7 @@ def main [
"status", "health", "diagnostics", "next", "phase"
]) {
dispatch_command $reordered_args $parsed_flags
if not $env.PROVISIONING_DEBUG { end_run "" }
if not ($env.PROVISIONING_DEBUG? | default false) { end_run "" }
return
}