Skip to content

Commit

Permalink
Fix -x-turn-echo-off adding the missing bool argument
Browse files Browse the repository at this point in the history
  • Loading branch information
eldipa committed Jun 13, 2022
1 parent b99a8fb commit 601b0fe
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ modules-test: clean_test

docs-test: clean_test
@$(python_bin) -W error test/r.py @test/minimum.env -- *.md
@$(python_bin) -W error test/r.py @test/minimum.env -x-turn-echo-off --skip docs/advanced/echo-filtering.md docs/recipes/python-doctest.md -- `find docs \( -name languages -prune -o -name "*.md" \) -type f`
@$(python_bin) -W error test/r.py @test/minimum.env docs/advanced/echo-filtering.md
@$(python_bin) -W error test/r.py @test/minimum.env -x-turn-echo-off yes --skip docs/advanced/echo-filtering.md docs/recipes/python-doctest.md -- `find docs \( -name languages -prune -o -name "*.md" \) -type f`
@$(python_bin) -W error test/r.py @test/minimum.env -x-turn-echo-off no docs/advanced/echo-filtering.md
@$(python_bin) -W error test/r.py @test/minimum.env -o '+py-doctest' docs/recipes/python-doctest.md
@$(python_bin) -m doctest docs/recipes/python-doctest.md
@make -s clean_test
Expand Down
15 changes: 14 additions & 1 deletion byexample/cmdline.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ def _show_failures_type(item):
return failures_num


def _true_false_type(answer):
answer = str(answer).lower()
if answer in {'yes', 'true', '1', 'y'}:
return True
elif answer in {'no', 'false', '0', 'n'}:
return False
else:
raise argparse.ArgumentTypeError(
"Invalid answer '%s'. Expected 'yes' or 'no'." % answer
)


class HelpExtraFormatter(argparse.HelpFormatter):
__hide = True
EPILOG = "==EPILOG=="
Expand Down Expand Up @@ -522,8 +534,9 @@ def parse_args(args=None):
)
g.add_argument(
"-x-turn-echo-off",
action='store_true',
action='store',
default=False,
type=_true_false_type,
help=
"turn off the echo on each example execution (ignored if force-echo-filtering is on); (default: %(default)s)."
)
Expand Down

0 comments on commit 601b0fe

Please sign in to comment.