pi_wake_agent.py: Add --dry-run flag

- --dry-run shows what would be done without executing
- Logs intended actions to log file
- Exits 0 without modifying crontab or sending wake messages
This commit is contained in:
Codex
2026-07-08 15:18:36 +02:00
parent d9284b7b75
commit 88eaf20363

View File

@@ -382,6 +382,7 @@ EXAMPLES:
parser.add_argument("--sessions", help="Comma-separated list of sessions") parser.add_argument("--sessions", help="Comma-separated list of sessions")
parser.add_argument("--msg", default=f"Operator says CONTINUE. {AGENT_NICK} here, saying hi!", help="Wake message") parser.add_argument("--msg", default=f"Operator says CONTINUE. {AGENT_NICK} here, saying hi!", help="Wake message")
parser.add_argument("--debug", action="store_true", help="Enable debug logging") parser.add_argument("--debug", action="store_true", help="Enable debug logging")
parser.add_argument("--dry-run", action="store_true", help="Show what would be done without executing")
parser.set_defaults(mode="install") parser.set_defaults(mode="install")
return parser return parser
@@ -417,6 +418,12 @@ def main() -> int:
logger.info(f"Message: {args.msg}") logger.info(f"Message: {args.msg}")
if args.mode == "succession": if args.mode == "succession":
logger.info(f"Count: {args.count}") logger.info(f"Count: {args.count}")
if args.dry_run:
logger.info("DRY RUN: no actions will be executed")
if args.dry_run:
logger.info("DRY RUN: would execute mode '%s' with sessions=%s, interval=%s, message='%s'", args.mode, sessions, args.interval, args.msg)
return 0
try: try:
if args.mode == "install": if args.mode == "install":