-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtake.rb
More file actions
37 lines (33 loc) · 1.13 KB
/
take.rb
File metadata and controls
37 lines (33 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# frozen_string_literal: true
require 'semantic_logger'
require_relative '../issue'
module Rubyists
# Namespace for Linear
module Linear
M :issue, :user
# Namespace for CLI
module CLI
module Issue
Take = Class.new Dry::CLI::Command
# The Take class is a Dry::CLI::Command that assigns an issue to yourself
class Take
include SemanticLogger::Loggable
include Rubyists::Linear::CLI::CommonOptions
include Rubyists::Linear::CLI::Issue # for #gimme_da_issue! and other Issue methods
desc 'Assign one or more issues to yourself'
argument :issue_ids, type: :array, required: true, desc: 'Issue Identifiers'
def call(issue_ids:, **options)
updates = issue_ids.map do |issue_id|
Rubyists::Linear::Issue.find(issue_id)
gimme_da_issue! issue_id # gimme_da_issue! is defined in Rubyists::Linear::CLI::Issue
rescue NotFoundError => e
logger.warn e.message
next
end.compact
display updates, options
end
end
end
end
end
end