def print_help_more(config): """Print extended help.""" action_descriptions = get_action_descriptions() actions_list = OptionGroup(parser, 'ACTION', '\n'.join(action_descriptions)) parser.add_option_group(actions_list) section_descriptions = get_section_descriptions(config) sections_list = OptionGroup(parser, 'SECTION', '\n'.join(section_descriptions)) parser.add_option_group(sections_list) parser.add_option_group(gravity) parser.add_option_group(w_h) parser.add_option_group(window) parser.print_help()
def print_help_more(config): """Print extended help.""" action_descriptions = [] for action in sorted(actions.manager.get_all(), key=lambda action: action.name): line = '%s\n %s\n %s' % (action.name, (action.__doc__ or '').split('\n')[0], ', '.join(action.obligatory_args).upper()) if action.obligatory_args and action.optional_args: line += ', ' if action.optional_args: line += '[%s]' % ', '.join(action.optional_args).upper() action_descriptions.append(line) actions_list = OptionGroup(parser, 'ACTION', '\n'.join(action_descriptions)) parser.add_option_group(actions_list) sections_list = OptionGroup(parser, 'SECTION', '\n'.join(sorted(config.sections, reverse=True))) parser.add_option_group(sections_list) parser.add_option_group(gravity) parser.add_option_group(w_h) parser.add_option_group(window) parser.print_help()
help='list all windows: <id> <desktop> <state> <name>') #parser.add_option('--desktops', # action='store_true', dest='list_desktops', default=False, # help='list desktops') # TODO output format # # Group of options related to actions # action = OptionGroup( parser, 'Options for Actions', 'If not provided, default values from config file will be used') for option in pywo.actions.parser.option_list: # NOTE: just copy options from actions.parser action.add_option(option) parser.add_option_group(action) # # Groups for --help-more # gravity = OptionGroup( parser, 'GRAVITY', '''\ Predefined names: TOP_LEFT, TL, UP_LEFT, UL, NW = 0,0 TOP, T, UP, U, N = 0.5,0 TOP_RIGHT, TR, UP_RIGHT, UR, NE = 1,0 LEFT, L = 0,0.5 MIDDLE, M, CENTER, C = 0.5,0.5 RIGHT, R = 1,0.5 BOTTOM_LEFT, BL, DOWN_LEFT, DL, SW = 0,1 BOTTOM, B, DOWN, D = 0.5,1
help='list all windows: <id> <desktop> <state> <name>') #parser.add_option('--desktops', # action='store_true', dest='list_desktops', default=False, # help='list desktops') # TODO output format # # Group of options related to actions # action = OptionGroup(parser, 'Options for Actions', 'If not provided, default values from config file will be used') for option in pywo.actions.parser.option_list: # NOTE: just copy options from actions.parser action.add_option(option) parser.add_option_group(action) # # Groups for --help-more # gravity = OptionGroup(parser, 'GRAVITY', '''\ Predefined names: TOP_LEFT, TL, UP_LEFT, UL, NW = 0,0 TOP, T, UP, U, N = 0.5,0 TOP_RIGHT, TR, UP_RIGHT, UR, NE = 1,0 LEFT, L = 0,0.5 MIDDLE, M, CENTER, C = 0.5,0.5 RIGHT, R = 1,0.5 BOTTOM_LEFT, BL, DOWN_LEFT, DL, SW = 0,1