Code: Alles auswählen
parser = OptionParser()
parser.add_option('-m','--mode', dest='mode', default='save',
help='What do you want to do, possibilities: save[default], replace, update, delete, print')
parser.add_option('--list-iter', dest='list_iter', default=False, action='store_true',
help='List all iterations in the database')
update_group = OptionGroup(parser, 'UPDATE and SAVE Options',
'These are options for saving or updating iterations. '
'You have to set "mode" to "save"[default] or "update", otherwise these options have no effect.')
update_group.add_option('--iteration', help='Only used by update. The number of the iteration for the update')
delete_group = OptionGroup(parser, 'DELETE Options',
'These are options for deleting iterations or particles. '
'You have to set "mode" to "delete", otherwise these options have no effect.')
delete_group.add_option('--del-iteration', help='Number of the iteration to delete')
parser.add_option_group(delete_group)
parser.add_option_group(update_group)
Vielleicht hat jemand eine Idee