changeset 5704:bbb286a9c138

script: Added MoinScript._update_option_help(). script.import.wikipage: update the --page option help message.
author Pascal Volk <user@localhost.localdomain.org>
date Sun, 06 Jun 2010 18:48:02 +0000
parents 7a226e00474b
children b0d90631ed9e
files MoinMoin/script/__init__.py MoinMoin/script/import/wikipage.py
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/__init__.py	Sun Jun 06 18:12:25 2010 +0200
+++ b/MoinMoin/script/__init__.py	Sun Jun 06 18:48:02 2010 +0000
@@ -171,6 +171,13 @@
             help="wiki page name [default: all pages]"
         )
 
+    def _update_option_help(self, opt_string, help_msg):
+        """ Update the help string of an option. """
+        for option in self.parser.option_list:
+            if option.get_opt_string() == opt_string:
+                option.help = help_msg
+                break
+
     def init_request(self):
         """ create request """
         from MoinMoin.web.contexts import ScriptContext
--- a/MoinMoin/script/import/wikipage.py	Sun Jun 06 18:12:25 2010 +0200
+++ b/MoinMoin/script/import/wikipage.py	Sun Jun 06 18:48:02 2010 +0000
@@ -43,6 +43,8 @@
         self.parser.add_option('--no-backup', dest='revision_backup',
                 default=True, action='store_false',
                 help="Suppress making a page backup per revision")
+        self._update_option_help('--page',
+                'Name of the wiki page which should be imported')
 
     def mainloop(self):
         self.init_request()