diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-11-08 13:16:21 +0000 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-11-08 13:16:21 +0000 |
commit | 95b3eec6d86a2ca05b993c1a2ec9a42dccdf0267 (patch) | |
tree | 55a0ee3b2ad2efa64a735d33554ecc3a013f4ac2 | |
parent | aeed96bd0abde745cee091b8d489fa345589ab37 (diff) | |
download | cliapp-95b3eec6d86a2ca05b993c1a2ec9a42dccdf0267.tar.gz |
Fix short option synopsis in manpages
-rw-r--r-- | NEWS | 9 | ||||
-rw-r--r-- | cliapp/genman.py | 10 |
2 files changed, 17 insertions, 2 deletions
@@ -1,6 +1,15 @@ NEWS for cliapp =============== +Version 1.20151108, released UNRELEASED +--------------------------------------- + +Bug fix: + +* The generated manpages used to have an equals sign for short options + with an argument. For example, `-e=REGEX`. This has now been fixed + to show the correct form, `-eREGEX`, instead. + Version 1.20150829 ------------------ diff --git a/cliapp/genman.py b/cliapp/genman.py index 5d47683..319ba86 100644 --- a/cliapp/genman.py +++ b/cliapp/genman.py @@ -77,10 +77,16 @@ class ManpageGenerator(object): def format_option_for_synopsis(self, option): if option.metavar: - suffix = '\\fR=\\fI%s' % self.esc_dashes(option.metavar) + short_suffix = '\\fI%s' % self.esc_dashes(option.metavar) + long_suffix = '\\fR=\\fI%s' % self.esc_dashes(option.metavar) else: - suffix = '' + short_suffix = '' + long_suffix = '' for name in option._short_opts + option._long_opts: + if name.startswith('--'): + suffix = long_suffix + else: + suffix = short_suffix yield '%s%s' % (self.esc_dashes(name), suffix) def format_options(self): |