Add allowed choices to output format.

Since we're using the print function, we can specify the file handler to
user and in this case we choose `sys.stderr`
This commit is contained in:
Pedro Algarvio 2015-07-12 12:27:26 +01:00
parent ef75ea068c
commit e6df8cbe24

View file

@ -36,6 +36,7 @@ def parse():
'-f', '-f',
'--format', '--format',
dest='format', dest='format',
choices=('pprint', 'yaml'),
default='pprint') default='pprint')
out = parser.parse_args() out = parser.parse_args()
return out.__dict__ return out.__dict__
@ -49,7 +50,7 @@ def mod_data(opts, full):
try: try:
finder.load_file(full) finder.load_file(full)
except ImportError: except ImportError:
sys.stderr.write('ImportError - {0}\n'.format(full)) print('ImportError - {0}'.format(full), file=sys.stderr)
return ret return ret
for name, mod in finder.modules.items(): for name, mod in finder.modules.items():
basemod = name.split('.')[0] basemod = name.split('.')[0]