mirror of
https://github.com/dgelessus/python-rsrcfork.git
synced 2024-12-22 17:30:17 +00:00
Don't pass required=True to add_subparsers
The required kwarg of add_subparsers was only added in Python 3.7, and we currently still support Python 3.6.
This commit is contained in:
parent
a9f54b678c
commit
b01cfc77cf
@ -671,7 +671,7 @@ rsrcfork library, which this tool is a part of.
|
|||||||
|
|
||||||
subs = ap.add_subparsers(
|
subs = ap.add_subparsers(
|
||||||
dest="subcommand",
|
dest="subcommand",
|
||||||
required=True,
|
# TODO Add required=True (added in Python 3.7) once we drop Python 3.6 compatibility.
|
||||||
metavar="SUBCOMMAND",
|
metavar="SUBCOMMAND",
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -804,7 +804,11 @@ handle resource compression).
|
|||||||
|
|
||||||
ns = ap.parse_args()
|
ns = ap.parse_args()
|
||||||
|
|
||||||
if ns.subcommand == "read-header":
|
if ns.subcommand is None:
|
||||||
|
# TODO Remove this branch once we drop Python 3.6 compatibility, because this case will be handled by passing required=True to add_subparsers (see above).
|
||||||
|
print("Missing subcommand", file=sys.stderr)
|
||||||
|
sys.exit(2)
|
||||||
|
elif ns.subcommand == "read-header":
|
||||||
do_read_header(ns)
|
do_read_header(ns)
|
||||||
elif ns.subcommand == "info":
|
elif ns.subcommand == "info":
|
||||||
do_info(ns)
|
do_info(ns)
|
||||||
|
Loading…
Reference in New Issue
Block a user