def build_cmd_parser(section): """ Populate the parser to get a list of valid options """ try: # Populate the parser to get a list of # valid options module = import_command(section) parser = module.build_parser(section) except (AttributeError, ImportError): # Use the default parser for section that don't # map to a command parser = GbpOptionParser(section) parser.parse_config_files() return parser
def print_cmd_all_values(cmd, printer): """ Print all configuration values of a command @param cmd: the cmd to print the values for @param printer: the printer to output the values """ if not cmd: return 2 try: # Populate the parser to get a list of # valid options module = import_command(cmd) parser = module.build_parser(cmd) except (AttributeError, ImportError): return 2 for option in parser.valid_options: value = parser.get_config_file_value(option) printer("%s.%s=%s" % (cmd, option, value)) return 0
def print_cmd_all_values(cmd, printer): """ Print all configuration values of a command @param cmd: the cmd to print the values for @param printer: the printer to output the values """ if not cmd: return 2 try: # Populae the parset to get a list of # valid options module = import_command(cmd) parser = module.build_parser(cmd) except (AttributeError, ImportError): return 2 for option in parser.valid_options: value = parser.get_config_file_value(option) if value != '': printer("%s.%s=%s" % (cmd, option, value)) return 0