wgctl/commands/group/watch.sh
Nuno Duque Nunes ce437968b4 feat: group migration complete
- commands/group/: 17 files, all subcommands migrated
- helpers.sh: real implementations, no invented functions
- set_main: uses peers::set_main_group
- rename: json::set + mv
- peer add/remove: group::add_peer, group::remove_peer
- block/unblock: block::add_group, block::remove_group
- purge-stale: inline stale detection via group::peers
- audit: no invented helper functions
- logs: command::load_subcmd logs show for direct function access
- logs/helpers.sh: extracted shared functions (follow, show_fw, show_wg, show_merged)
- group rule unassign: stub (not yet implemented)
- notes: group watch pending, monitor module refactor pending
2026-05-31 02:44:19 +00:00

20 lines
629 B
Bash

#!/usr/bin/env bash
# commands/group/watch.sh
function cmd::group::watch::on_load() {
flag::define --name value "Group name" required label:name
flag::define --fw bool "Firewall only"
flag::define --wg bool "WireGuard only"
flag::exclusive --fw --wg
}
function cmd::group::watch::run() {
flag::parse "$@" || return 1
local name; name=$(flag::value --name)
local fw=false wg=false
flag::bool --fw && fw=true
flag::bool --wg && wg=true
[[ -z "$name" ]] && log::error "Missing required flag: --name" && return 1
group::require_exists "$name" || return 1
cmd::group::_watch_impl "$name" "$fw" "$wg"
}