Browse Source

Add --debug option

master
Jim Paris 7 months ago
parent
commit
ffe13a45e6
1 changed files with 8 additions and 3 deletions
  1. +8
    -3
      backup.py

+ 8
- 3
backup.py View File

@@ -225,15 +225,20 @@ def main(argv: list[str]):
parser.add_argument('-b', '--borg',
help="Borg command", default=str(base / "borg.sh"))
parser.add_argument('-n', '--dry-run', action="store_true",
help="Just print filenames, don't run borg")
help="Just print log output, don't run borg")
parser.add_argument('-d', '--debug', action="store_true",
help="Print filenames for --dry-run")

args = parser.parse_args()
config = Config(args.config)

backup = Backup(config, args.dry_run)
if args.dry_run:
with open(os.devnull, "wb") as out:
backup.run(out)
if args.debug:
backup.run(sys.stdout.buffer)
else:
with open(os.devnull, "wb") as out:
backup.run(out)
else:
borg = subprocess.Popen([args.borg,
"create",


Loading…
Cancel
Save