#NEWLINE# def do_list( self , arg ) : #NEWLINE# #INDENT# 'List mail in specified folder.' #NEWLINE# try : #NEWLINE# #INDENT# args = docopt . docopt ( '\n' . join ( [ 'Usage: list [options] [<directory>]' , '' , 'Options:' , '    -l, --limit=<LIMIT>    Limit number of mail displayed' , '    -h, --help             Show this message' ] ) , argv = arg ) #NEWLINE# #UNINDENT# except SystemExit : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# limit = int ( ( args [ '--limit' ] or 10 ) ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# limit = 10 #NEWLINE# #UNINDENT# for mail_info in search . fetch_mails_info ( self . imap_account , limit = limit ) : #NEWLINE# #INDENT# sys . stdout . write ( 'UID : {:<10} From : {:<40.40} Subject : {:.50}\n' . format ( mail_info [ 'uid' ] , mail_info [ 'from' ] , mail_info [ 'subject' ] ) )