From c0d9c6173b38edc0aaca4319cc9f57412abd4f64 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Wed, 1 Jul 2020 02:03:49 +0100 Subject: [PATCH] cli: remove unneeded boolean arguments --- Makefile | 1 + tqdm/cli.py | 5 +++-- tqdm/tqdm.1 | 16 ++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index f0c5e5f8..d9091cad 100644 --- a/Makefile +++ b/Makefile @@ -91,6 +91,7 @@ tqdm/tqdm.1: .meta/.tqdm.1.md tqdm/cli.py tqdm/std.py python -m tqdm --help | tail -n+5 |\ sed -r -e 's/\\/\\\\/g' \ -e 's/^ (--.*)=<(.*)> : (.*)$$/\n\\\1=*\2*\n: \3./' \ + -e 's/^ (--.*) : (.*)$$/\n\\\1\n: \2./' \ -e 's/ (-.*, )(--.*) /\n\1\\\2\n: /' |\ cat "$<" - |\ pandoc -o "$@" -s -t man diff --git a/tqdm/cli.py b/tqdm/cli.py index 1dd0e034..82fd3d92 100644 --- a/tqdm/cli.py +++ b/tqdm/cli.py @@ -198,8 +198,9 @@ def main(fp=sys.stderr, argv=None): # d = RE_OPTS.sub(r' --\1=<\1> : \2', d) split = RE_OPTS.split(d) opt_types_desc = zip(split[1::3], split[2::3], split[3::3]) - d = ''.join('\n --{0}=<{1}> : {2}{3}'.format( - otd[0].replace('_', '-'), otd[0], *otd[1:]) + d = ''.join(('\n --{0} : {2}{3}' if otd[1] == 'bool' else + '\n --{0}=<{1}> : {2}{3}').format( + otd[0].replace('_', '-'), otd[0], *otd[1:]) for otd in opt_types_desc if otd[0] not in UNSUPPORTED_OPTS) d = """Usage: diff --git a/tqdm/tqdm.1 b/tqdm/tqdm.1 index c994c7d4..7f988bbd 100644 --- a/tqdm/tqdm.1 +++ b/tqdm/tqdm.1 @@ -63,7 +63,7 @@ specify an initial arbitrary large positive number, e.g. .RS .RE .TP -.B \-\-leave=\f[I]leave\f[] +.B \-\-leave bool, optional. If [default: True], keeps all traces of the progressbar upon termination of iteration. @@ -117,7 +117,7 @@ The fallback is to use ASCII characters " 123456789#". .RS .RE .TP -.B \-\-disable=\f[I]disable\f[] +.B \-\-disable bool, optional. Whether to disable the entire progressbar wrapper [default: False]. If set to None, disable on non\-TTY. @@ -140,7 +140,7 @@ If any other non\-zero number, will scale \f[C]total\f[] and \f[C]n\f[]. .RS .RE .TP -.B \-\-dynamic\-ncols=\f[I]dynamic_ncols\f[] +.B \-\-dynamic\-ncols bool, optional. If set, constantly alters \f[C]ncols\f[] and \f[C]nrows\f[] to the environment (allowing for window resizes) [default: False]. @@ -202,7 +202,7 @@ float, optional. .RS .RE .TP -.B \-\-write\-bytes=\f[I]write_bytes\f[] +.B \-\-write\-bytes bool, optional. If (default: None) and \f[C]file\f[] is unspecified, bytes will be written in Python 2. @@ -243,7 +243,7 @@ specified. .RS .RE .TP -.B \-\-bytes=\f[I]bytes\f[] +.B \-\-bytes bool, optional. If true, will count bytes, ignore \f[C]delim\f[], and default \f[C]unit_scale\f[] to True, \f[C]unit_divisor\f[] to 1024, and @@ -258,21 +258,21 @@ If true, passes \f[C]stdin\f[] to both \f[C]stderr\f[] and .RS .RE .TP -.B \-\-update=\f[I]update\f[] +.B \-\-update bool, optional. If true, will treat input as newly elapsed iterations, i.e. numbers to pass to \f[C]update()\f[]. .RS .RE .TP -.B \-\-update\-to=\f[I]update_to\f[] +.B \-\-update\-to bool, optional. If true, will treat input as total elapsed iterations, i.e. numbers to assign to \f[C]self.n\f[]. .RS .RE .TP -.B \-\-null=\f[I]null\f[] +.B \-\-null bool, optional. If true, will discard input (no stdout). .RS