display backup.py usage if no action was specified
authorPhilipp Gesang <philipp.gesang@intra2net.com>
Thu, 2 Mar 2017 13:36:43 +0000 (14:36 +0100)
committerPhilipp Gesang <philipp.gesang@intra2net.com>
Thu, 2 Mar 2017 13:37:09 +0000 (14:37 +0100)
Getting no feedback if the invocation had no effect is rather
unseemly. Print the help message instead.

backup.py

index 26c9de7..3566967 100644 (file)
--- a/backup.py
+++ b/backup.py
@@ -124,4 +124,10 @@ if __name__ == "__main__":
         else:
             deltatar.restore_backup(args.targetpath, backup_tar_path=args.sourcepath)
     elif args.equals:
-        check_equal_dirs(os.path.abspath(args.sourcepath), os.path.abspath(args.targetpath), deltatar)
\ No newline at end of file
+        check_equal_dirs(os.path.abspath(args.sourcepath), os.path.abspath(args.targetpath), deltatar)
+    else:
+        import sys
+        print("Nothing to do.\nPlease specify one of --full, --diff, --list-files, "
+              "--restore, --equals.\n", file=sys.stderr)
+        parser.print_help(file=sys.stderr)
+