#!/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"
}
