Skip to content

Commit

Permalink
cli: remove unneeded boolean arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Sep 12, 2020
1 parent 7249910 commit c0d9c61
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions tqdm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
16 changes: 8 additions & 8 deletions tqdm/tqdm.1
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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].
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit c0d9c61

Please sign in to comment.