def execute(self, env, args):
        """ Removes a task.

            `env`
                Runtime ``Environment`` instance.
            `args`
                Arguments object from arg parser.
            """

        # extract args
        task_name = args.task_name
        force = args.force

        if env.task.active and env.task.name == task_name:
            raise errors.ActiveTask

        if not env.task.exists(task_name):
            raise errors.TaskNotFound(task_name)

        if force:
            env.task.remove(task_name)

        else:
            try:
                while True:
                    prompt = ('Are you sure you want to delete "{0}" (y/n)? '
                              .format(task_name))
                    resp = env.io.prompt(prompt, newline=False).lower()

                    if resp in ('y', 'n'):
                        if resp == 'y':
                            env.task.remove(task_name)
                        break

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

            `env`
                Runtime ``Environment`` instance.
            `args`
                Arguments object from arg parser.