Fix no help display in python3

This commit is contained in:
Davis Goglin 2016-03-16 16:21:05 -07:00 committed by Davis Goglin
parent 5ba751d89b
commit 4f92247ed6
1 changed files with 8 additions and 3 deletions

View File

@ -3,6 +3,7 @@
from __future__ import absolute_import from __future__ import absolute_import
import argparse import argparse
import sys
import six import six
from . import config from . import config
@ -308,12 +309,16 @@ def main():
action='store_true', action='store_true',
) )
# Get only arguments actually passed
args_dict = vars(parser.parse_args())
if not args_dict:
parser.print_help()
sys.exit()
command_arguments = dict([k, v] for k, v in six.iteritems(args_dict) if v)
if not printer: if not printer:
raise Exception('No printers loaded from config') raise Exception('No printers loaded from config')
# Get only arguments actually passed
args_dict = vars(parser.parse_args())
command_arguments = dict([k, v] for k, v in six.iteritems(args_dict) if v)
target_command = command_arguments.pop('func') target_command = command_arguments.pop('func')