#NEWLINE# def arg_parser( * args , **kwargs ) : #NEWLINE# #INDENT# 'Return a parser with common options used in the prawtools commands.' #NEWLINE# msg = { #NEWLINE# #INDENT# 'site' : 'The site to connect to defined in your praw.ini file.' , #NEWLINE# 'user' : 'The user to login as. If not specified the user (if any) from the site config will be used, otherwise you will be prompted for a username.' , #NEWLINE# 'pswd' : 'The password to use for login. Can only be used in combination with "--user". See help for "--user".' , #NEWLINE# 'update' : 'Prevent the checking for prawtools package updates.' , #NEWLINE# #UNINDENT# } #NEWLINE# kwargs [ 'version' ] = "BBoe's PRAWtools {0}" . format ( __version__ ) #NEWLINE# parser = OptionParser ( * args , ** kwargs ) #NEWLINE# parser . add_option ( '-v' , '--verbose' , action = 'count' , default = 0 , help = 'Increase the verbosity by 1 each time' ) #NEWLINE# parser . add_option ( '-U' , '--disable-update-check' , action = 'store_true' , help = msg [ 'update' ] ) #NEWLINE# group = OptionGroup ( parser , 'Site/Authentication options' ) #NEWLINE# group . add_option ( '-S' , '--site' , help = msg [ 'site' ] ) #NEWLINE# group . add_option ( '-u' , '--user' , help = msg [ 'user' ] ) #NEWLINE# group . add_option ( '-p' , '--pswd' , help = kwargs [ 'pswd' ] ) #NEWLINE# parser . add_option_group ( group ) #NEWLINE# return parser