Commit cfbe650f by Julien Muchembled

wip

1 parent 8b29ab2c
...@@ -273,8 +273,8 @@ def main(): ...@@ -273,8 +273,8 @@ def main():
help='only show log entries from the given node' help='only show log entries from the given node'
' (only useful for logs produced by threaded tests),' ' (only useful for logs produced by threaded tests),'
" special value '-' hides the column") " special value '-' hides the column")
_('-s', '--sleep-interval', type=float, default=1, metavar='N', _('-s', '--sleep-interval', type=float, default=1., metavar='N',
help='with -f, sleep for approximately N seconds (default 1.0)' help='with -f, sleep for approximately N seconds (default %(default)s)'
' between iterations') ' between iterations')
_('--from', dest='filter_from', metavar='N', _('--from', dest='filter_from', metavar='N',
help='show records more recent that timestamp N if N > 0, or now+N' help='show records more recent that timestamp N if N > 0, or now+N'
......
...@@ -683,11 +683,21 @@ def console(port, app): ...@@ -683,11 +683,21 @@ def console(port, app):
t.daemon = 1 t.daemon = 1
t.start() t.start()
class ArgumentDefaultsHelpFormatter(argparse.HelpFormatter):
def _format_action(self, action):
if not (action.help or action.default in (None, argparse.SUPPRESS)):
action.help = '(default: %(default)s)'
return super(ArgumentDefaultsHelpFormatter, self)._format_action(action)
def main(): def main():
parser = argparse.ArgumentParser() kw = dict(formatter_class=ArgumentDefaultsHelpFormatter)
parser = argparse.ArgumentParser(**kw)
_ = parser.add_argument _ = parser.add_argument
_('-6', '--ipv6', dest='address_type', action='store_const', _('-6', '--ipv6', dest='address_type', action='store_const',
default=socket.AF_INET, const=socket.AF_INET6) default=socket.AF_INET, const=socket.AF_INET6, help='(default: IPv4)')
_('-a', '--adapter', choices=sorted(DATABASE_MANAGER_DICT), _('-a', '--adapter', choices=sorted(DATABASE_MANAGER_DICT),
default='SQLite') default='SQLite')
_('-d', '--datadir') _('-d', '--datadir')
...@@ -698,16 +708,17 @@ def main(): ...@@ -698,16 +708,17 @@ def main():
_('-r', '--replicas', type=int, default=1) _('-r', '--replicas', type=int, default=1)
parsers = parser.add_subparsers(dest='command') parsers = parser.add_subparsers(dest='command')
_ = parsers.add_parser('run').add_argument _ = parsers.add_parser('run', **kw).add_argument
_('-c', '--clients', type=int, default=10) _('-c', '--clients', type=int, default=10)
_('-t', '--threads', type=int, default=1) _('-t', '--threads', type=int, default=1)
_('-C', '--console', type=int, default=0, help='console port (localhost)') _('-C', '--console', type=int, default=0,
help='console port (localhost) (default: any)')
_('-D', '--delay', type=float, default=.01) _('-D', '--delay', type=float, default=.01)
_ = parsers.add_parser('check').add_argument _ = parsers.add_parser('check', **kw).add_argument
_('tid', nargs='?') _('tid', nargs='?')
_ = parsers.add_parser('bisect').add_argument _ = parsers.add_parser('bisect', **kw).add_argument
args = parser.parse_args() args = parser.parse_args()
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!