Skip to content

Commit e28487d

Browse files
committed
Quick rubocop cleanup
1 parent 4327406 commit e28487d

3 files changed

Lines changed: 15 additions & 10 deletions

File tree

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
linear-cli (0.4.4)
4+
linear-cli (0.4.5)
55
base64 (~> 0.2)
66
dry-cli (~> 1.0)
77
dry-cli-completion (~> 1.0)

lib/linear/cli/sub_commands.rb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,16 @@ def const_added(const)
1515
end
1616
end
1717

18-
def ask_for_team # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
18+
def choose_a_team!(teams)
19+
prompt.on(:keypress) do |event|
20+
prompt.trigger(:keydown) if event.value == 'j'
21+
prompt.trigger(:keyup) if event.value == 'k'
22+
end
23+
key = prompt.select('Choose a team', teams.to_h { |t| [t.name, t.key] })
24+
Rubyists::Linear::Team.find key
25+
end
26+
27+
def ask_for_team
1928
teams = Rubyists::Linear::Team.mine
2029
if teams.size == 1
2130
logger.info('Only one team found, using it', team: teams.first.name)
@@ -24,12 +33,7 @@ def ask_for_team # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
2433
logger.error('No teams found for you. Please join a team or pass an existing team name.')
2534
raise SmellsBad, 'No team given and none found for you'
2635
else
27-
prompt.on(:keypress) do |event|
28-
prompt.trigger(:keydown) if event.value == 'j'
29-
prompt.trigger(:keyup) if event.value == 'k'
30-
end
31-
key = prompt.select('Choose a team', teams.to_h { |t| [t.name, t.key] })
32-
Rubyists::Linear::Team.find key
36+
choose_a_team! teams
3337
end
3438
end
3539

lib/linear/commands/issue/create.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

33
require 'semantic_logger'
4+
require_relative '../issue'
45

56
module Rubyists
67
# Namespace for Linear
@@ -14,11 +15,11 @@ module Issue
1415
class Create
1516
include SemanticLogger::Loggable
1617
include Rubyists::Linear::CLI::CommonOptions
17-
include Rubyists::Linear::CLI::Issue # for #gimme_da_issue and other methods
18+
include Rubyists::Linear::CLI::Issue # for #gimme_da_issue! and other Issue methods
1819
desc 'Create a new issue'
1920
option :title, type: :string, aliases: ['-t'], desc: 'Issue Title'
20-
option :team, type: :string, aliases: ['-T'], desc: 'Team Identifier'
2121
option :description, type: :string, aliases: ['-d'], desc: 'Issue Description'
22+
option :team, type: :string, aliases: ['-T'], desc: 'Team Identifier'
2223
option :labels, type: :array, aliases: ['-l'], desc: 'Labels for the issue (Comma separated list)'
2324

2425
def call(**options)

0 commit comments

Comments
 (0)