#!/usr/bin/env bash # commands/mixins/.mixin.sh # Template for creating a new mixin # # 1. Copy this file to core/mixins/ (framework) or commands/mixins/ (wgctl-specific) # 2. Replace with your mixin name (e.g. peer_filter, time_filter) # 3. Replace with your flag (e.g. --name, --since) # 4. Add state variable and accessor function # 5. In on_load: command::mixin # State variable _COMMAND_=false # or "" for string values # Called when command::mixin is used in on_load function command::mixin::::register() { flag::register -- # Add more flag::register calls if needed } # Called before each command invocation to reset state function command::mixin::::reset() { _COMMAND_=false } # Called for each arg — return 0 if consumed, 1 if not function command::mixin::::process() { case "$1" in --) _COMMAND_=true; return 0 ;; esac return 1 } # Public accessor — used by commands function command::() { [[ "${_COMMAND_:-false}" == "true" ]]; }