git » abk » commit cd745ef

Fix options parsing.

author Alberto Bertogli
2005-07-11 06:21:07 UTC
committer Alberto Bertogli
2005-07-11 06:21:07 UTC
parent 06a0c4fb181db9c45f803d914c7e1fd9c7ee1702

Fix options parsing.

abk +9 -5

diff --git a/abk b/abk
index c0a31d6..3643058 100644
--- a/abk
+++ b/abk
@@ -125,7 +125,7 @@ def finfo_copy_file_reg_gzip(finfo, dst):
 	dfile.close()
 
 # the copy function is modified by configuration
-finfo_copy_file_reg = finfo_copy_file_reg_gzip
+#finfo_copy_file_reg = finfo_copy_file_reg_gzip
 
 
 def finfo_copy_file_link(finfo, dst):
@@ -506,15 +506,19 @@ commands:
 		action="store_false", dest="verbose",
 		help="don't print progress information (just errors)")
 	parser.add_option("-c", "--copy-mode", default='gzip', metavar="MODE",
+		action="store", dest="copy_mode",
 		help="select copy mode to use. Available modes: "
 		"raw, gzip, bzip2 [default: gzip]")
 	parser.add_option("-a", "--hash-mode", default='sha', metavar="MODE",
+		action="store", dest="hash_mode",
 		help="select the hash to use to check for file content change. "
 		"Available modes: none, sha, md5 [default: sha]")
-	parser.add_option("-e", "--exclude", metavar="REGEX", action="append",
+	parser.add_option("-e", "--exclude", metavar="REGEX",
+		action="append", dest="exclude",
 		help="excludes files that matches with the regular expression. "
 		"This option accepts multiple instances")
 	parser.add_option("-i", "--new-idx", metavar="FILE",
+		action="store", dest="new_idx",
 		help="select where to write the new generated index. "
 		"This is useful for incremental backups. "
 		"If not specified, the old index file (idx) is overwritten")
@@ -532,11 +536,11 @@ verbose = opts.verbose
 
 # configuration
 if opts.copy_mode == 'raw':
-	file_info_copy_file_reg = finfo_copy_file_reg_raw
+	finfo_copy_file_reg = finfo_copy_file_reg_raw
 elif opts.copy_mode == 'gzip':
-	file_info_copy_file_reg = finfo_copy_file_reg_gzip
+	finfo_copy_file_reg = finfo_copy_file_reg_gzip
 elif opts.copy_mode == 'bzip2':
-	file_info_copy_file_reg = finfo_copy_file_reg_bzip2
+	finfo_copy_file_reg = finfo_copy_file_reg_bzip2
 else:
 	parser.error("Invalid copy mode (%s)." % opts.copy_mode)