- 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
22 lines
792 B
Bash
22 lines
792 B
Bash
#!/usr/bin/env bash
|
|
# commands/group/purge-stale.sh
|
|
|
|
function cmd::group::purge_stale::on_load() {
|
|
flag::define --name value "Group name (or --all)" label:name
|
|
flag::define --all bool "Purge all groups"
|
|
flag::define --force bool "Skip confirmation"
|
|
flag::define --dry-run bool "Show what would be removed"
|
|
flag::exclusive --name --all
|
|
}
|
|
|
|
function cmd::group::purge_stale::run() {
|
|
flag::parse "$@" || return 1
|
|
local name; name=$(flag::value --name)
|
|
local all=false force=false dry_run=false
|
|
flag::bool --all && all=true
|
|
flag::bool --force && force=true
|
|
flag::bool --dry-run && dry_run=true
|
|
[[ -z "$name" && "$all" == "false" ]] && \
|
|
log::error "Specify --name or --all" && return 1
|
|
cmd::group::_purge_stale_impl "$name" "$all" "$force" "$dry_run"
|
|
}
|