Sha256: 895c3cda65be4cf27ae6c39803ca15179200c8ce3a45c59419ca939d0d1a03f1

Contents?: true

Size: 573 Bytes

Versions: 1

Compression:

Stored size: 573 Bytes

Contents

# frozen_string_literal: true

module TooDoo
  module Commands
    # remove a task
    # usage: td remove <body>
    class Remove < Base
      def description
        <<~END
          remove a task
          usage: td remove <body>
        END
      end

      def perform!
        return puts(description) if args.empty?

        result = store.remove(args.join(' '))
        puts build_message(result)
      end

      private

      def build_message(task)
        return 'there is no such task' if task.nil?
        "deleted - #{task.body}"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
toodoo-0.1.1 lib/toodoo/commands/remove.rb