Strip trailing periods when getting description
This yields slightly prettier output. Change-Id: Ibec7cd861eacc3630182d6a782ffaf361f449aa6 Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
This commit is contained in:
parent
91c62985fb
commit
fb9a3a9b2d
|
@ -75,7 +75,7 @@ class HelpAction(argparse.Action):
|
||||||
if namespace.debug:
|
if namespace.debug:
|
||||||
traceback.print_exc(file=out)
|
traceback.print_exc(file=out)
|
||||||
continue
|
continue
|
||||||
one_liner = cmd.get_description().split('\n')[0]
|
one_liner = cmd.get_description().split('\n')[0].rstrip('.')
|
||||||
dist_name = dist_for_obj(factory)
|
dist_name = dist_for_obj(factory)
|
||||||
if dist_name and dist_name != app_dist:
|
if dist_name and dist_name != app_dist:
|
||||||
dist_info = ' (' + dist_name + ')'
|
dist_info = ' (' + dist_name + ')'
|
||||||
|
|
|
@ -103,8 +103,8 @@ class TestHelp(base.TestBase):
|
||||||
self.assertIn('usage: %s [--version]' % basecommand, help_text)
|
self.assertIn('usage: %s [--version]' % basecommand, help_text)
|
||||||
self.assertRegex(help_text, 'option(s|al arguments):\n --version')
|
self.assertRegex(help_text, 'option(s|al arguments):\n --version')
|
||||||
expected = (
|
expected = (
|
||||||
' one Test command.\n'
|
' one Test command\n'
|
||||||
' three word command Test command.\n'
|
' three word command Test command\n'
|
||||||
)
|
)
|
||||||
self.assertIn(expected, help_text)
|
self.assertIn(expected, help_text)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Trailing periods will now be stripped from the oneline summary shown
|
||||||
|
for the help command. This better aligns with the format used by
|
||||||
|
argparse itself.
|
Loading…
Reference in New Issue