Skip to content

Commit

Permalink
Merge pull request #48 from eparis/better-error-on-wrong-subcommand
Browse files Browse the repository at this point in the history
Return a better error if you forget to add the subcommand
  • Loading branch information
openshift-merge-robot authored Feb 18, 2020
2 parents fef06ad + 853eef5 commit 65d25e4
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions hack/graph-util.py
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ def get_token(args):

if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Utilities for managing graph data.')
subparsers = parser.add_subparsers()
subparsers = parser.add_subparsers(dest='command')

push_to_quay_parser = subparsers.add_parser(
'push-to-quay',
Expand All @@ -489,10 +489,11 @@ def get_token(args):
'--versions',
help='Comma Seperated Versions to sync',
)
push_to_quay_parser.set_defaults(action='push-to-quay')

args = parser.parse_args()

token = get_token(args=args)
if args.action == 'push-to-quay':
if args.command == 'push-to-quay':
token = get_token(args=args)
push(directory='.', token=token, push_versions=args.versions)
else:
parser.print_usage()

0 comments on commit 65d25e4

Please sign in to comment.