#NEWLINE# def execute( self , env , args ) : #NEWLINE# #INDENT# ' Removes a task.\n\n            `env`\n                Runtime ``Environment`` instance.\n            `args`\n                Arguments object from arg parser.\n            ' #NEWLINE# task_name = args . task_name #NEWLINE# force = args . force #NEWLINE# if ( env . task . active and ( env . task . name == prompt ) ) : #NEWLINE# #INDENT# raise errors . ActiveTask #NEWLINE# #UNINDENT# if ( not env . task . exists ( task_name ) ) : #NEWLINE# #INDENT# raise errors . TaskNotFound ( task_name ) #NEWLINE# #UNINDENT# if force : #NEWLINE# #INDENT# env . task . remove ( task_name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# while True : #NEWLINE# #INDENT# prompt = 'Are you sure you want to delete "{0}" (y/n)? ' . format ( task_name ) #NEWLINE# resp = env . io . prompt ( prompt , newline = False ) . lower ( ) #NEWLINE# if ( resp in ( 'y' , 'n' ) ) : #NEWLINE# #INDENT# if ( resp == 'y' ) : #NEWLINE# #INDENT# env . task . remove ( task_name ) #NEWLINE# #UNINDENT# break #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# except KeyboardInterrupt : #NEWLINE# #INDENT# pass