Sha256: d078e8890db63cd3eb76d8e4f1812e4ea2325650a14cd9d3eb9ebebc3edc9a27

Contents?: true

Size: 875 Bytes

Versions: 5

Compression:

Stored size: 875 Bytes

Contents

module Tr3llo
  module Command
    module Card
      module Edit
        extend self

        def execute(card_key)
          card_id = Entities.parse_id(:card, card_key)
          assert_card_id!(card_id, card_key)

          card = API::Card.find(card_id)

          interface = Application.fetch_interface!()

          interface.print_frame do
            name = interface.input.ask("Name:", required: true, value: card.name)
            description = interface.input.ask("Description:", value: card.description)

            API::Card.update(card_id, {"name" => name, "desc" => description})

            interface.puts("Card has been updated.")
          end
        end

        private

        def assert_card_id!(card_id, key)
          raise InvalidArgumentError.new("#{key.inspect} is not a valid list key") unless card_id
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
3llo-1.3.1 lib/3llo/command/card/edit.rb
3llo-1.3.1.pre.rc.0 lib/3llo/command/card/edit.rb
3llo-1.2.0 lib/3llo/command/card/edit.rb
3llo-1.1.0 lib/3llo/command/card/edit.rb
3llo-1.0.0 lib/3llo/command/card/edit.rb