Sha256: daece3bdb17cacc5e630516277de49371de3af3c631c337932305d1744f534ba

Contents?: true

Size: 793 Bytes

Versions: 7

Compression:

Stored size: 793 Bytes

Contents

require 'dude/project_management/client'

module Dude
  module Commands
    class Tasks < Dry::CLI::Command
      include Settings

      desc "Print tasks as list with ID's and assignees"

      def call
        tasks = Dude::ProjectManagement::Client.new.get_current_tasks
        lists = tasks.map {|issue| issue.status}.uniq

        lists.each do |list|
          puts "#{list}:".green.bold
          tasks.map do |issue|
            puts printable_issue_template(issue) if issue.status == list
          end
          puts "\n"
        end
      end

      private

      def printable_issue_template(issue)
        return "#{issue.id.to_s.bold}: #{issue.title}" + " (#{issue.assignee})".blue if issue.assignee
        "#{issue.id.to_s.bold}: #{issue.title}"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dude-cli-2.0.6 lib/dude/commands/tasks.rb
dude-cli-2.0.5 lib/dude/commands/tasks.rb
dude-cli-2.0.4 lib/dude/commands/tasks.rb
dude-cli-2.0.3 lib/dude/commands/tasks.rb
dude-cli-2.0.2 lib/dude/commands/tasks.rb
dude-cli-2.0.1 lib/dude/commands/tasks.rb
dude-cli-2.0.0 lib/dude/commands/tasks.rb