Strip leading or trailing '-' when generating patch names
[stgit] / stgit / argparse.py
index 0a5f66a..baf278b 100644 (file)
@@ -37,7 +37,7 @@ class opt(object):
         return optparse.make_option(*self.pargs, **kwargs)
     def metavar(self):
         o = self.get_option()
-        if not o.nargs:
+        if not o.takes_value():
             return None
         if o.metavar:
             return o.metavar
@@ -103,7 +103,7 @@ def write_asciidoc(cmd, f):
             o.write_asciidoc(f)
             f.write('\n')
     _write_underlined('StGit', '-', f)
-    f.write('Part of the StGit suite - see manlink:stg[1]\n')
+    f.write('Part of the StGit suite - see linkman:stg[1]\n')
 
 def sign_options():
     def callback(option, opt_str, value, parser, sign_str):
@@ -161,6 +161,7 @@ def message_options(save_template):
             short = 'Use MESSAGE instead of invoking the editor'),
         opt('-f', '--file', action = 'callback', callback = file_callback,
             dest = 'message', type = 'string', args = [files],
+            metavar = 'FILE',
             short = 'Use FILE instead of invoking the editor', long = """
             Use the contents of FILE instead of invoking the editor.
             (If FILE is "-", write to stdout.)""")]
@@ -220,6 +221,15 @@ def _person_opts(person, short):
 def author_options():
     return _person_opts('author', 'auth')
 
+def keep_option():
+    return [opt('-k', '--keep', action = 'store_true',
+                short = 'Keep the local changes',
+                default = config.get('stgit.autokeep') == 'yes')]
+
+def merged_option():
+    return [opt('-m', '--merged', action = 'store_true',
+                short = 'Check for patches merged upstream')]
+
 class CompgenBase(object):
     def actions(self, var): return set()
     def words(self, var): return set()