def parseargs(): parser = OptParser(option_class=OptChecker , description=' '.join(DESCRIPTION.split()) , version='%prog version $Revision: #12 $' ) parser.setHelp(_help) parser.set_usage('%prog ' + _usage) parser.remove_option('-h') parser.add_option('-f', '--file', default='', help='the name of a file containing the re-sync file list.') parser.add_option('-v', '--verbose', action='store_true', help='debug output.', default=False) parser.add_option('-h', '-?', '--help', action='help', help='show this help message and exit.', default=False) parser.add_option('--usage', action="briefhelp") parser.add_option('-d', '--master_data_directory', type='string', dest="masterDataDirectory", metavar="<master data directory>", help="Optional. The master host data directory. If not specified, the value set for $MASTER_DATA_DIRECTORY will be used.", default=get_masterdatadir() ) parser.add_option('-a', help='don\'t ask to confirm repairs', dest='confirm', default=True, action='store_false') """ Parse the command line arguments """ (options, args) = parser.parse_args() if len(args) > 0: logger.error('Unknown argument %s' % args[0]) parser.exit() return options, args
def parse_command_line(): parser = OptParser(option_class=OptChecker, description=' '.join(_description.split())) parser.setHelp(_help) parser.set_usage('%prog ' + _usage) parser.remove_option('-h') parser.add_option('--start', action='store_true', help='Start the Greenplum Performance Monitor web server.') parser.add_option('--stop', action='store_true', help='Stop the Greenplum Performance Monitor web server.') parser.add_option('--restart', action='store_true', help='Restart the Greenplum Performance Monitor web server.') parser.add_option('--status', action='store_true', help='Display the status of the Gerrnplum Performance Monitor web server.') parser.add_option('--setup', action='store_true', help='Setup the Greenplum Performance Monitor web server.') parser.add_option('--version', action='store_true', help='Display version information') parser.add_option('--upgrade', action='store_true', help='Upgrade a previous installation of the Greenplum Performance Monitors web UI') parser.set_defaults(verbose=False,filters=[], slice=(None, None)) # Parse the command line arguments (options, args) = parser.parse_args() if options.version: version() sys.exit(0) # check for too many options opt_count = 0 if options.start: opt_count+=1 if options.stop: opt_count+=1 if options.setup: opt_count+=1 if options.upgrade: opt_count+=1 if options.status: opt_count+=1 if opt_count > 1: parser.print_help() parser.exit() return options, args
def parseargs(): parser = OptParser(option_class=OptChecker, description=' '.join(DESCRIPTION.split()), version='%prog version $Revision: #12 $') parser.setHelp(_help) parser.set_usage('%prog ' + _usage) parser.remove_option('-h') parser.add_option( '-f', '--file', default='', help='the name of a file containing the re-sync file list.') parser.add_option('-v', '--verbose', action='store_true', help='debug output.', default=False) parser.add_option('-h', '-?', '--help', action='help', help='show this help message and exit.', default=False) parser.add_option('--usage', action="briefhelp") parser.add_option( '-d', '--master_data_directory', type='string', dest="masterDataDirectory", metavar="<master data directory>", help= "Optional. The master host data directory. If not specified, the value set for $MASTER_DATA_DIRECTORY will be used.", default=get_masterdatadir()) parser.add_option('-a', help='don\'t ask to confirm repairs', dest='confirm', default=True, action='store_false') """ Parse the command line arguments """ (options, args) = parser.parse_args() if len(args) > 0: logger.error('Unknown argument %s' % args[0]) parser.exit() return options, args