INNER CODE UNIT · Python

handle_help

google/deepconsensus · deepconsensus/cli.py:61

def handle_help(passed, module):
  """Print a better help screen for subcommands."""
  if '-h' in passed or '--help' in passed or len(sys.argv) == 2:
    flag_set = module.flags.FLAGS.flags_by_module_dict()[module.__name__]
    print(module.__doc__, file=sys.stderr)
    flag_help = []
    for flag in flag_set:
      out = f'    --{flag.name:<20} {flag.help}'
      if flag.default:
        out += f' [default: {flag.default}]'
      flag_help.append(out)
    print('Flags:', file=sys.stderr)
    for flag in flag_help:
      print(
          textwrap.fill(
              flag,
              width=80,
              subsequent_indent=' ' * 27,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…