prvng_core/nulib/libremote.nu
Jesús Pérez c62e967ce3
chore: complete KCL to Nickel migration cleanup and setup pre-commit
Clean up 404 KCL references (99.75% complete):
   - Rename kcl_* variables to schema_*/nickel_* (kcl_path→schema_path, etc.)
   - Update functions: parse_kcl_file→parse_nickel_file
   - Update env vars: KCL_MOD_PATH→NICKEL_IMPORT_PATH
   - Fix cli/providers-install: add has_nickel and nickel_version variables
   - Correct import syntax: .nickel.→.ncl.
   - Update 57 files across core, CLI, config, and utilities

   Configure pre-commit hooks:
   - Activate: nushell-check, nickel-typecheck, markdownlint
   - Comment out: Rust hooks (fmt, clippy, test), check-yaml

   Testing:
   - Module discovery: 9 modules (6 providers, 1 taskserv, 2 clusters) 
   - Syntax validation: 15 core files 
   - Pre-commit hooks: all passing 
2026-01-08 20:08:46 +00:00

89 lines
2.2 KiB
Plaintext

export def _ansi [
arg: string
]: nothing -> string {
if (is-terminal --stdout) {
$"(ansi $arg)"
} else {
""
}
}
export def log_debug [
msg: string
]: nothing -> nothing {
use std
std log debug $msg
}
export def format_out [
data: string
src?: string
mode?: string
]: nothing -> string {
let msg = match $src {
"json" => ($data | from json),
_ => $data,
}
match $mode {
"table" => {
($msg | table -i false)
},
_ => { $msg }
}
}
export def _print [
data: string
src?: string
context?: string
mode?: string
]: nothing -> nothing {
if ($env.PROVISIONING_OUT | is-empty) {
print (format_out $data $src $mode)
} else {
match $env.PROVISIONING_OUT {
"json" => {
if $context != "result" { return }
if $src == "json" {
print ($data)
} else {
print ($data | to json)
}
},
"yaml" | "yml" => {
if $context != "result" { return }
if $src == "json" {
print ($data | from json | to yaml)
} else {
print ($data | to yaml)
}
},
"text" | "txt" => {
if $context != "result" { return }
print (format_out $data $src $mode)
},
_ => {
if ($env.PROVISIONING_OUT | str ends-with ".json" ) {
if $context != "result" { return }
(if $src == "json" {
($data)
} else {
($data | to json)
} | save --force $env.PROVISIONING_OUT)
} else if ($env.PROVISIONING_OUT | str ends-with ".yaml" ) {
if $context != "result" { return }
(if $src == "json" {
($data | from json | to yaml)
} else {
($data | to yaml)
} | save --force $env.PROVISIONING_OUT)
} else if ($env.PROVISIONING_OUT | str ends-with ".text" ) or ($env.PROVISIONING_OUT | str ends-with ".txt" ) {
if $context != "result" { return }
format_out $data $src $mode | save --force $env.PROVISIONING_OUT
} else {
format_out $data $src $mode | save --append $env.PROVISIONING_OUT
}
}
}
}
}