Add dry-run option
This commit is contained in:
1 parent
27b781a534
commit
126ae85388
3 files changed
+28
-25
No files matched your search
@@ -20,28 +20,25 @@ def main():
|
||||
prog="cura-te-ipsum", description="cura-te-ipsum, my personal backup software.",
|
||||
)
|
||||
parser.add_argument("-V", "--version", action="version", version="%(prog)s 0.1")
|
||||
parser.add_argument(
|
||||
"-v",
|
||||
"--verbose",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="print verbose information",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-b",
|
||||
type=pathlib.Path,
|
||||
dest="backup_dir",
|
||||
metavar="BACKUP_DIR",
|
||||
required=True,
|
||||
help="directory, where all backups will be stored",
|
||||
)
|
||||
parser.add_argument(
|
||||
"sources",
|
||||
nargs="+",
|
||||
metavar="SOURCE",
|
||||
type=pathlib.Path,
|
||||
help="backup source (file/dir/smth else)",
|
||||
)
|
||||
parser.add_argument("-v", "--verbose",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="print verbose information")
|
||||
parser.add_argument("-b",
|
||||
dest="backup_dir",
|
||||
metavar="BACKUP_DIR",
|
||||
type=pathlib.Path,
|
||||
required=True,
|
||||
help="directory, where all backups will be stored")
|
||||
parser.add_argument("-n", "--dry-run",
|
||||
action="store_true",
|
||||
default=False,
|
||||
help="Do not do create backup")
|
||||
parser.add_argument("sources",
|
||||
nargs="+",
|
||||
metavar="SOURCE",
|
||||
type=pathlib.Path,
|
||||
help="backup source (file/dir/smth else)")
|
||||
args = parser.parse_args()
|
||||
|
||||
loglevel = logging.DEBUG if args.verbose else logging.INFO
|
||||
@@ -58,7 +55,7 @@ def main():
|
||||
_lg.error("Source directory %s does not exist", src_dir)
|
||||
return 1
|
||||
|
||||
initiate_backup(args.sources, backup_dir_abs)
|
||||
initiate_backup(args.sources, backup_dir_abs, dry_run=args.dry_run)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in new issue
Block a user