Revision 5786c087

b/autotools/build-bash-completion
575 575
  help_option = cli.cli_option("-h", "--help", default=False,
576 576
                               action="store_true")
577 577

  
578
  for (_, _, optdef, _, _) in commands.itervalues():
578
  for name, (_, _, optdef, _, _) in commands.items():
579 579
    if help_option not in optdef:
580 580
      optdef.append(help_option)
581
    if cli.DEBUG_OPT not in optdef:
582
      optdef.append(cli.DEBUG_OPT)
581
    for opt in cli.COMMON_OPTS:
582
      if opt in optdef:
583
        raise Exception("Common option '%s' listed for command '%s' in %s" %
584
                        (opt, name, filename))
585
      optdef.append(opt)
583 586

  
584 587
  # Use aliases
585 588
  aliases = getattr(module, "aliases", {})
b/lib/cli.py
1029 1029
                                action="store_false", default=True,
1030 1030
                                help="Disable support for DRBD")
1031 1031

  
1032
#: Options provided by all commands
1033
COMMON_OPTS = [DEBUG_OPT]
1034

  
1032 1035

  
1033 1036
def _ParseArgs(argv, commands, aliases):
1034 1037
  """Parser for the command line arguments.
......
1096 1099
    cmd = aliases[cmd]
1097 1100

  
1098 1101
  func, args_def, parser_opts, usage, description = commands[cmd]
1099
  parser = OptionParser(option_list=parser_opts + [DEBUG_OPT],
1102
  parser = OptionParser(option_list=parser_opts + COMMON_OPTS,
1100 1103
                        description=description,
1101 1104
                        formatter=TitledHelpFormatter(),
1102 1105
                        usage="%%prog %s %s" % (cmd, usage))

Also available in: Unified diff