#NEWLINE# @ click . command ( help = 'Fetch the bookmarked document with the given NAME.' ) #NEWLINE# @ click . argument ( 'name' , nargs = 1 ) #NEWLINE# def bookmarks_get( name ) : #NEWLINE# #INDENT# bookmarks = get_bookmarks ( ) #NEWLINE# bookmark = bookmarks . get ( name ) #NEWLINE# if ( bookmark is None ) : #NEWLINE# #INDENT# click . echo ( ( 'Bookmark "%s" does not exist.' % name ) ) #NEWLINE# return #NEWLINE# #UNINDENT# url = bookmark [ 'url' ] #NEWLINE# client = get_client ( ) #NEWLINE# history = get_history ( ) #NEWLINE# try : #NEWLINE# #INDENT# doc = client . get ( url ) #NEWLINE# #UNINDENT# except coreapi . exceptions . ErrorMessage as exc : #NEWLINE# #INDENT# click . echo ( display ( exc . error ) ) #NEWLINE# sys . exit ( 1 ) #NEWLINE# #UNINDENT# click . echo ( display ( doc ) ) #NEWLINE# if isinstance ( doc , coreapi . Document ) : #NEWLINE# #INDENT# history = history . add ( doc ) #NEWLINE# set_document ( doc ) #NEWLINE# set_history ( history )