Bug 1621960: Improves error when "profile" is called without any arguments in py3 r=ahal

By explicitly specifying that `subparsers.required = True`, we encourage argparse to provide a useful message,
rather than "'NoneType' is not callable", when no arguments are provided.

Depends on D77966

Differential Revision: https://phabricator.services.mozilla.com/D77967
This commit is contained in:
Mitchell Hentges 2020-06-09 18:48:19 +00:00
parent c28298cb71
commit efb66eaac8

View File

@ -264,7 +264,8 @@ def rm(profile, pref_file):
def cli(args=sys.argv[1:]):
parser = ArgumentParser()
subparsers = parser.add_subparsers()
subparsers = parser.add_subparsers(dest='func')
subparsers.required = True
diff_parser = subparsers.add_parser('diff')
diff_parser.add_argument('a', metavar='A',