Sha256: 7f1dcddc706a81bd5a6c5ad9fed332df4b80f35ae1760be8206dc7457f40dea9

Contents?: true

Size: 546 Bytes

Versions: 1

Compression:

Stored size: 546 Bytes

Contents

# frozen_string_literal: true

require 'pry'

module TooDoo
  module Commands
    # add a new task
    # usage: td add <body>
    class Add < Base
      def description
        <<~END
          add a new task
          usage: td add <task>
        END
      end

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

        task = Task.new(args.join(' '))
        store.save(task)
        puts build_message(task)
      end

      private

      def build_message(task)
        "created - #{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/add.rb