Aggiunge backup no-GUI per scheduler
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import logging
|
||||
import threading
|
||||
@@ -11,6 +12,7 @@ from PIL import Image, ImageDraw
|
||||
import pystray
|
||||
|
||||
from .backup import run_backup, shutdown_after_backup
|
||||
from .backup_nogui import run_nogui_backup
|
||||
from .config import AppConfig, load_config
|
||||
from .logging_setup import configure_logging
|
||||
from .registry import ChangeRegistry
|
||||
@@ -101,7 +103,22 @@ def _show_error_message(title: str, message: str) -> None:
|
||||
root.destroy()
|
||||
|
||||
|
||||
def main() -> int:
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
parser = argparse.ArgumentParser(description="Bak&Rest tray app")
|
||||
parser.add_argument(
|
||||
"--nogui",
|
||||
action="store_true",
|
||||
help="Run backup and shutdown without tray icon",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--no-shutdown",
|
||||
action="store_true",
|
||||
help="With --nogui, run the backup but do not shut down the computer",
|
||||
)
|
||||
args = parser.parse_args(argv)
|
||||
if args.nogui:
|
||||
return run_nogui_backup(shutdown=not args.no_shutdown)
|
||||
|
||||
config = load_config()
|
||||
logger = configure_logging(config.storage.logs_dir, "tray")
|
||||
app = BakRestTrayApp(config, logger)
|
||||
|
||||
Reference in New Issue
Block a user