Don't prompt for one entry handling with -f. trunk

Thu, 10 Jul 2008 18:44:06 -0400

author
Brett Smith <brett@brettcsmith.org>
date
Thu, 10 Jul 2008 18:44:06 -0400
branch
trunk
changeset 66
af0b822b012e
parent 65
0aea49161478
child 67
1b4ca6de7740

Don't prompt for one entry handling with -f.

-f makes the answer to the "what do you want to do with this one file"
question clear, so the user shouldn't be asked for the answer.

scripts/dtrx file | annotate | diff | comparison | revisions
tests/tests.yml file | annotate | diff | comparison | revisions
--- a/scripts/dtrx	Thu Jun 05 22:54:10 2008 -0400
+++ b/scripts/dtrx	Thu Jul 10 18:44:06 2008 -0400
@@ -643,6 +643,11 @@
                " * extract it Here"]
     prompt = "What do you want to do?  (I/r/h) "
 
+    def __init__(self, options):
+        BasePolicy.__init__(self, options)
+        if options.flat:
+            self.permanent_policy = EXTRACT_HERE
+
     def prep(self, archive_filename, extractor):
         question = ["%s contains one %s, but it has a weird name." %
                     (archive_filename, extractor.content_type)]
--- a/tests/tests.yml	Thu Jun 05 22:54:10 2008 -0400
+++ b/tests/tests.yml	Thu Jul 10 18:44:06 2008 -0400
@@ -586,3 +586,10 @@
     cd test-tar-with-node
     tar -zxf ../$1
   grep: Cannot mknod
+
+- name: flat extraction of one-file archive
+  directory: inside-dir
+  options: -f
+  filenames: ../test-onefile.tar.gz
+  baseline: tar -zxf $1
+  antigrep: "contains"

mercurial