wgctl/commands/config/show.sh
Nuno Duque Nunes a559b73e8e feat: new flag::define syntax, flag::set_constraint
- flag::define: variadic constraint args (key:value) instead of bracket string
- flag::_parse_constraints_from_args: replaces flag::_parse_and_cache
- flag::set_constraint: Option B syntax for post-definition constraints
- choices separator: comma (choices:split,full) — no quoting needed
- guard against empty _CURRENT_COMMAND in exclusive groups lookup
- migrate all commands to new constraint syntax
- add helpful error for unknown constraint args
2026-05-31 00:16:55 +00:00

24 lines
No EOL
679 B
Bash

#!/usr/bin/env bash
# commands/config/show.sh
function cmd::config::show::on_load() {
help::section "Filters"
flag::define --name value "Peer name" label:name required:true section:Filters
flag::define --type value "Filter by type" label:type section:Filters
}
function cmd::config::show::run() {
flag::parse "$@" || return 1
local name; name=$(flag::value --name)
local type; type=$(flag::value --type)
[[ -z "$name" ]] && log::error "Missing required flag: --name" && return 1
name=$(peers::resolve_and_require "$name" "$type") || return 1
local conf
conf="$(ctx::clients)/${name}.conf"
log::section "Client Config: ${name}"
cat "$conf"
}