2019-11-19 04:43:23 -08:00
|
|
|
#!/usr/bin/env python3
|
2019-11-19 04:41:38 -08:00
|
|
|
|
|
|
|
|
2023-03-27 18:50:11 -07:00
|
|
|
from domain.BackupRotator import BackupRotator
|
|
|
|
|
2019-11-19 04:41:38 -08:00
|
|
|
|
2022-01-31 12:35:08 -08:00
|
|
|
import argparse
|
|
|
|
|
2019-11-19 04:41:38 -08:00
|
|
|
|
|
|
|
def main():
|
|
|
|
|
2022-01-31 12:35:08 -08:00
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
description="Mike's Backup Rotator. Helps automatically remove old backup files or folders."
|
|
|
|
)
|
|
|
|
|
|
|
|
parser.add_argument(
|
|
|
|
"--config", "-c",
|
|
|
|
dest="config_files",
|
|
|
|
default=[],
|
|
|
|
action="append",
|
|
|
|
type=str,
|
|
|
|
help="Specify a configuration file. Can be called multiple times."
|
|
|
|
)
|
|
|
|
parser.add_argument(
|
|
|
|
"--dry-run", "-d",
|
|
|
|
dest="dry_run",
|
|
|
|
default=False,
|
|
|
|
action="store_true",
|
|
|
|
help="Only perform an analysis; Don't delete anything."
|
|
|
|
)
|
|
|
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
2019-11-19 04:41:38 -08:00
|
|
|
rotator = BackupRotator()
|
2022-01-31 12:35:08 -08:00
|
|
|
rotator.run(
|
|
|
|
configs=args.config_files,
|
|
|
|
dry_run=args.dry_run
|
|
|
|
)
|
|
|
|
|
2019-11-19 04:41:38 -08:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|
2022-01-31 12:35:08 -08:00
|
|
|
|