"""
need_help = False
+ do_help = False
opts = (opt[0] for opt in global_opts)
for opt in opts:
if opt in ('-h', '--help'):
+ do_help = True
if args:
need_help = True
else:
- print_help( module_info, formatted_options)
- sys.exit(0)
+ do_help = True
elif opt in ('-q','--quiet'):
gentoolkit.CONFIG['quiet'] = True
elif opt in ('-C', '--no-color', '--nocolor'):
sys.exit(0)
elif opt in ('--debug'):
gentoolkit.CONFIG['debug'] = True
+ if do_help:
+ print_help( module_info, formatted_options)
+ sys.exit(0)
return need_help
"""local function for interpreting command line options
and setting options accordingly"""
return_code = True
+ do_help = False
for o, a in opts:
if o in ("-h", "--help"):
- if action:
- raise ParseArgsException('help-'+action)
- else:
- raise ParseArgsException('help')
+ do_help = True
elif o in ("-V", "--version"):
raise ParseArgsException('version')
elif o in ("-C", "--nocolor"):
print( pp.error(
"--%s only makes sense in --destructive mode." % opt), file=sys.stderr)
options[opt] = False
+ if do_help:
+ if action:
+ raise ParseArgsException('help-'+action)
+ else:
+ raise ParseArgsException('help')
return return_code
# here are the different allowed command line options (getopt args)
"""
need_help = False
+ do_help = False
opts = (opt[0] for opt in global_opts)
for opt in opts:
if opt in ('-h', '--help'):
if args:
need_help = True
else:
- print_help()
- sys.exit(0)
+ do_help = True
elif opt in ('-q','--quiet'):
CONFIG['quiet'] = True
elif opt in ('-C', '--no-color', '--nocolor'):
sys.exit(0)
elif opt in ('--debug'):
CONFIG['debug'] = True
-
+ if do_help:
+ print_help()
+ sys.exit(0)
return need_help
'keep-temp', 'library=', 'no-ld-path', 'no-order',
'pretend', 'no-pretend', 'no-progress', 'quiet', 'verbose'])
+ do_help = False
for key, val in opts:
if key in ('-h', '--help'):
- print_usage()
- sys.exit(0)
+ do_help = True
elif key in ('-q', '--quiet'):
settings['quiet'] = True
settings['VERBOSITY'] = 0
print(red('Unrecognized option\n'))
print_usage()
sys.exit(2)
+ if do_help:
+ print_usage()
+ sys.exit(0)
return settings