]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-99735: Use required=True in argparse subparsers example (GH-100927)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 19 Feb 2023 19:35:09 +0000 (11:35 -0800)
committerGitHub <noreply@github.com>
Sun, 19 Feb 2023 19:35:09 +0000 (11:35 -0800)
(cherry picked from commit 6aab56f3c2ee331116eba242d2fcdca592577328)

Co-authored-by: Patricio Paez <nospam@pp.com.mx>
Doc/library/argparse.rst

index 3971c000b2a02fa6f194c5b5bbb5d8cb07d0ddba..b6ecf8a2542c98b34438d9da5264ac196d47fb98 100644 (file)
@@ -1771,7 +1771,7 @@ Sub-commands
      ...
      >>> # create the top-level parser
      >>> parser = argparse.ArgumentParser()
-     >>> subparsers = parser.add_subparsers()
+     >>> subparsers = parser.add_subparsers(required=True)
      >>>
      >>> # create the parser for the "foo" command
      >>> parser_foo = subparsers.add_parser('foo')