<s> from optparse import OptionParser , make_option <EOL> import sys <EOL> class CLI ( object ) : <EOL> color = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> } <EOL> @ staticmethod <EOL> def show_colors ( ) : <EOL> CLI . color = { <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> } <EOL> @ staticmethod <EOL> def parse ( args = None ) : <EOL> parser = OptionParser ( option_list = CLI . options_to_parser ( ) ) <EOL> parser . add_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" , <EOL> dest = "<STR_LIT>" , <EOL> default = False , <EOL> help = "<STR_LIT>" ) <EOL> return parser . parse_args ( args ) <EOL> @ classmethod <EOL> def options_to_parser ( cls ) : <EOL> return ( <EOL> make_option ( "<STR_LIT:-c>" , "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = <NUM_LIT:1> , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" , <EOL> dest = "<STR_LIT>" , <EOL> default = False , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" , <EOL> dest = "<STR_LIT>" , <EOL> default = False , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" , <EOL> dest = "<STR_LIT>" , <EOL> default = False , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" , <EOL> dest = "<STR_LIT>" , <EOL> default = False , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" , <EOL> dest = "<STR_LIT>" , <EOL> default = False , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" , <EOL> dest = "<STR_LIT>" , <EOL> default = False , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" , <EOL> dest = "<STR_LIT>" , <EOL> default = False , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> dest = "<STR_LIT:password>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = "<STR_LIT>" , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> action = "<STR_LIT:store_true>" , <EOL> dest = "<STR_LIT>" , <EOL> default = False , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> type = "<STR_LIT:int>" , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) , <EOL> make_option ( "<STR_LIT>" , <EOL> dest = "<STR_LIT>" , <EOL> default = None , <EOL> help = "<STR_LIT>" ) , <EOL> ) <EOL> @ classmethod <EOL> def error_and_exit ( cls , msg ) : <EOL> cls . msg ( "<STR_LIT>" % msg , "<STR_LIT>" ) <EOL> sys . exit ( <NUM_LIT:1> ) <EOL> @ classmethod <EOL> def info_and_exit ( cls , msg ) : <EOL> cls . msg ( "<STR_LIT>" % msg , "<STR_LIT>" ) <EOL> sys . exit ( <NUM_LIT:0> ) <EOL> @ classmethod <EOL> def msg ( cls , msg , color = "<STR_LIT>" ) : <EOL> print ( "<STR_LIT>" . format ( cls . color [ color ] , msg , cls . color [ "<STR_LIT>" ] ) ) </s>
