[PATCH] User removes attachments in text mode.

Carl Chenet carl.chenet at ohmytux.com
Tue Apr 14 20:02:38 UTC 2009


---
 bin/reportbug |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/bin/reportbug b/bin/reportbug
index 528ece3..e4a5446 100755
--- a/bin/reportbug
+++ b/bin/reportbug
@@ -187,10 +187,10 @@ def handle_editing(filename, dmessage, options, sendto, attachments, package,
         if not subject:
             ui.long_message('No subject found in message.  Please edit again.\n')
 
-        menuopts = "Ynaceilmpq"
+        menuopts = "Ynaceilmpqd"
 
         if not changed or not subject:
-            menuopts = "ynacEilmpq"
+            menuopts = "ynacEilmpqd"
 
         # cfr Debian BTS #293361
         if package == 'wnpp':
@@ -207,6 +207,7 @@ def handle_editing(filename, dmessage, options, sendto, attachments, package,
                                "save it in a temporary file (exits reportbug).",
                                'q': "Save it in a temporary file and quit.",
                                'a': "Attach a file.",
+                               'd': "Detach a file.",
                                'i': "Include a text file.",
                                'c': "Change editor and re-edit.",
                                'e': 'Re-edit the bug report.',
@@ -234,6 +235,18 @@ def handle_editing(filename, dmessage, options, sendto, attachments, package,
                         ui.display_failure("Can't find %s to include!\n", attachfile)
                 else:
                     break
+        elif x == 'd':
+            skip_editing = True
+            if not attachments:
+                ewrite('No file to detached.\n')
+            else:
+                detachprompt = 'Choose a file to detach:'
+                myattachments = []
+                myattachments = [(x, '') for x in attachments]
+                filetodetach = ui.menu( detachprompt, myattachments, 
+                    'Select the file:', default='', empty_ok=True)
+                attachments.remove(filetodetach)
+                ewrite('File successfully detached.\n')
         elif x == 'c':
             ed = ui.get_filename('Choose editor: ', default=options.editor)
             if ed:
-- 
1.5.4.3


--=-Y4407623QWMOfSmAolNu--






More information about the Reportbug-maint mailing list