wgctl/commands/logs/rotate.sh
Nuno Duque Nunes 8ed491313d feat: command framework + logs migration
- core/framework/flag.sh: flag::define, flag::parse, accessors
- core/framework/hook.sh: hook::on, hook::fire, hook::off, hook::has
- core/framework/help.sh: help::section, command::help::auto
- core/framework/command.sh: command::define, command::route, lazy loading
- core restructure: framework/ + app/ separation
- load_command: directory-based command detection
- command::exists: accepts new-style commands
- command::run: routing for new-style, legacy fallback
- commands/logs/: migrated to new framework
  - logs.sh: router + command::define
  - show.sh: flag::define + flag::parse, no manual case blocks
  - clean.sh: flag::define + flag::parse
  - remove.sh: flag::define + flag::parse
  - rotate.sh: flag::define + flag::parse
- logs clean: fix dry_run bool to int conversion
- ctx::json_helper: fixed path after core restructure
- PYTHONPATH: exported in app/core.sh
2026-05-30 03:44:08 +00:00

18 lines
No EOL
588 B
Bash

#!/usr/bin/env bash
# commands/logs/rotate.sh
function cmd::logs::rotate::on_load() {
flag::define --days value "Remove entries older than N days" [default=30, type=int, min=1, label="days"]
flag::define --force bool "Skip confirmation"
flag::define --dry-run bool "Show what would be removed"
}
function cmd::logs::rotate::run() {
flag::parse "$@" || return 1
local days; days=$(flag::value --days)
local force=false dry_run=false
flag::bool --force && force=true
flag::bool --dry-run && dry_run=true
cmd::logs::_rotate_impl "$days" "$force" "$dry_run"
}