provisioning-core/nulib/cli/runner_daemon.nu

39 lines
1.3 KiB
Text
Raw Permalink Normal View History

#!/usr/bin/env nu
# Thin entry for runner daemon commands.
# Loads only cli/handlers/runner_daemon.nu.
export-env {
let lib_dirs_raw = ($env.NU_LIB_DIRS? | default "")
let current_lib_dirs = if ($lib_dirs_raw | describe) == "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_debug = ($env.PROVISIONING_DEBUG? | default "")
if ($raw_debug | describe) == "string" and ($raw_debug | is-not-empty) {
$env.PROVISIONING_DEBUG = (do $_coerce $raw_debug)
}
}
use cli/flags.nu [parse_common_flags]
use cli/handlers/runner_daemon.nu *
def main [
...args: string
--yes (-y)
--debug (-x)
--notitles
]: 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 {
yes: $yes, debug: $debug, notitles: $notitles
})
handle_runner_command $cmd $ops $flags
}