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