48 lines
1.7 KiB
Text
48 lines
1.7 KiB
Text
#!/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
|
|
}
|