Browse code

* s3cmd: Exit with error code on error (patch from Kim-Minh KAPLAN, SF #1800583)

git-svn-id: https://s3tools.svn.sourceforge.net/svnroot/s3tools/s3cmd/trunk@150 830e0280-6d2a-0410-9c65-932aecc39d9d

Michal Ludvig authored on 2007/09/26 09:24:52
Showing 2 changed files
... ...
@@ -1,5 +1,10 @@
1 1
 2007-09-25  Michal Ludvig  <michal@logix.cz>
2 2
 
3
+	* s3cmd: Exit with error code on error (patch
4
+	  from Kim-Minh KAPLAN, SF #1800583)
5
+
6
+2007-09-25  Michal Ludvig  <michal@logix.cz>
7
+
3 8
 	* S3/S3.py: Don't fail if bucket listing doesn't have
4 9
 	  <IsTruncated> node.
5 10
 	* s3cmd: Create ~/.s3cfg with 0600 permissions.
... ...
@@ -597,15 +597,23 @@ if __name__ == '__main__':
597 597
 	optparser.add_option("-c", "--config", dest="config", metavar="FILE", help="Config file name. Defaults to %default")
598 598
 	optparser.add_option(      "--dump-config", dest="dump_config", action="store_true", help="Dump current configuration after parsing config files and command line options and exit.")
599 599
 
600
+	optparser.add_option("-n", "--dry-run", dest="dry_run", action="store_true", help="Only show what should be uploaded or downloaded but don't actually do it. May still perform S3 requests to get bucket listings though.")
601
+
600 602
 	optparser.add_option("-e", "--encrypt", dest="encrypt", action="store_true", help="Encrypt files before uploading to S3.")
603
+	optparser.add_option(      "--no-encrypt", dest="encrypt", action="store_false", help="Don't encrypt files.")
601 604
 	optparser.add_option("-f", "--force", dest="force", action="store_true", help="Force overwrite and other dangerous operations.")
602 605
 	optparser.add_option("-P", "--acl-public", dest="acl_public", action="store_true", help="Store objects with ACL allowing read by anyone.")
606
+	optparser.add_option(      "--acl-private", dest="acl_public", action="store_false", help="Store objects with default ACL allowing access by you only.")
603 607
 	optparser.add_option(      "--delete-removed", dest="delete_removed", action="store_true", help="Delete remote objects with no corresponding local file [sync]")
608
+	optparser.add_option(      "--no-delete-removed", dest="delete_removed", action="store_false", help="Don't delete remote objects.")
609
+	optparser.add_option("-p", "--preserve", dest="preserve_attrs", action="store_true", help="Preserve filesystem attributes (mode, ownership, timestamps). Default for [sync] command.")
610
+	optparser.add_option(      "--no-preserve", dest="preserve_attrs", action="store_false", help="Don't store FS attributes")
604 611
 
605 612
 	optparser.add_option("-m", "--mime-type", dest="default_mime_type", type="mimetype", metavar="MIME/TYPE", help="Default MIME-type to be set for objects stored.")
606 613
 	optparser.add_option("-M", "--guess-mime-type", dest="guess_mime_type", action="store_true", help="Guess MIME-type of files by their extension. Falls back to default MIME-Type as specified by --mime-type option")
607 614
 
608 615
 	optparser.add_option("-H", "--human-readable-sizes", dest="human_readable_sizes", action="store_true", help="Print sizes in human readable form.")
616
+
609 617
 	optparser.add_option("-v", "--verbose", dest="verbosity", action="store_const", const=logging.INFO, help="Enable verbose output.")
610 618
 	optparser.add_option("-d", "--debug", dest="verbosity", action="store_const", const=logging.DEBUG, help="Enable debug output.")
611 619
 	optparser.add_option(      "--version", dest="show_version", action="store_true", help="Show s3cmd version (%s) and exit." % (PkgInfo.version))
... ...
@@ -692,7 +700,10 @@ if __name__ == '__main__':
692 692
 		cmd_func(args)
693 693
 	except S3Error, e:
694 694
 		error("S3 error: " + str(e))
695
+		sys.exit(1)
695 696
 	except ParameterError, e:
696 697
 		error("Parameter problem: " + str(e))
698
+		sys.exit(1)
697 699
 
700
+	sys.exit(0)
698 701