#NEWLINE# @ command #NEWLINE# @ completers ( 'path' ) #NEWLINE# def editor( self , path ) : #NEWLINE# #INDENT# path = format_path ( self . _cli . current_path , path ) #NEWLINE# document = self . _resources . get ( cmd ) #NEWLINE# tmp_file = tempfile . mktemp ( ) #NEWLINE# with open ( tmp_file , 'w' ) as file : #NEWLINE# #INDENT# file . write ( json_pretty ( document . source ) ) #NEWLINE# #UNINDENT# cmd = '{} {}' . format ( config [ 'grafcli' ] [ 'editor' ] , tmp_file ) #NEWLINE# exit_status = os . system ( cmd ) #NEWLINE# if ( not exit_status ) : #NEWLINE# #INDENT# self . _cli . log ( 'Updating: {}' . format ( path ) ) #NEWLINE# self . file_import ( tmp_file , path ) #NEWLINE# #UNINDENT# os . unlink ( tmp_file )