33 lines
1.1 KiB
Text
33 lines
1.1 KiB
Text
# Shared Integration Utilities
|
|
# Plugin detection, status checking, and flag parsing
|
|
|
|
# Check if a plugin is available
|
|
export def is-plugin-available [plugin_name: string] {
|
|
(plugin list | where name == $plugin_name | length) > 0
|
|
}
|
|
|
|
# Check if provisioning plugins are loaded
|
|
export def plugins-status [] {
|
|
{
|
|
auth: (is-plugin-available "nu_plugin_auth")
|
|
kms: (is-plugin-available "nu_plugin_kms")
|
|
orchestrator: (is-plugin-available "nu_plugin_orchestrator")
|
|
}
|
|
}
|
|
|
|
# Helper to parse flags from args
|
|
export def parse-flag [args: list, long_flag: string, short_flag: string = ""] {
|
|
let long_idx = ($args | enumerate | where item == $long_flag | get index | first | default null)
|
|
if ($long_idx != null) {
|
|
return ($args | get ($long_idx + 1) | default null)
|
|
}
|
|
|
|
if ($short_flag | is-not-empty) {
|
|
let short_idx = ($args | enumerate | where item == $short_flag | get index | first | default null)
|
|
if ($short_idx != null) {
|
|
return ($args | get ($short_idx + 1) | default null)
|
|
}
|
|
}
|
|
|
|
null
|
|
}
|