- 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
22 lines
No EOL
736 B
Bash
22 lines
No EOL
736 B
Bash
#!/usr/bin/env bash
|
|
# commands/logs/remove.sh
|
|
|
|
function cmd::logs::remove::on_load() {
|
|
flag::define --name value "Filter by peer name" label:name
|
|
flag::define --since value "Remove entries since" label:time
|
|
flag::define --fw bool "Remove firewall logs only"
|
|
flag::define --wg bool "Remove WireGuard logs only"
|
|
flag::define --force bool "Skip confirmation"
|
|
}
|
|
|
|
function cmd::logs::remove::run() {
|
|
flag::parse "$@" || return 1
|
|
local name; name=$(flag::value --name)
|
|
local since; since=$(flag::value --since)
|
|
local force=false fw=false wg=false
|
|
flag::bool --force && force=true
|
|
flag::bool --fw && fw=true
|
|
flag::bool --wg && wg=true
|
|
|
|
cmd::logs::_remove_impl "$name" "$since" "$fw" "$wg" "$force"
|
|
} |