]> 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:11:40 +0000 (11:11 -0800)
committerGitHub <noreply@github.com>
Sun, 19 Feb 2023 19:11:40 +0000 (11:11 -0800)
(cherry picked from commit 6aab56f3c2ee331116eba242d2fcdca592577328)

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

index eeb65160bbc8ef4bb6f1a67a7cfd91b09b18f7cb..7a36c5264aa0e7a153a8ab70b54bf9af07569b96 100644 (file)
@@ -1854,7 +1854,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')