Skip to content

Commit

Permalink
Ensures reason_for accepts a - to prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
bougyman committed Feb 6, 2024
1 parent f298bf2 commit 13fd073
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
linear-cli (0.7.6)
linear-cli (0.7.7)
base64 (~> 0.2)
dry-cli (~> 1.0)
dry-cli-completion (~> 1.0)
Expand Down
9 changes: 6 additions & 3 deletions lib/linear/cli/what_for.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ def team_for(key = nil)
end

def reason_for(reason = nil, four: nil)
return reason if reason
return reason if reason && reason != '-'

question = four ? "Reason for #{four}:" : 'Reason:'
prompt.ask(question)
question = four ? "Reason for #{TTY::Markdown.parse(four)}" : 'Reason'
answer = prompt.ask("#{question} (- to open an editor):", default: '-')
return answer unless answer == '-'

editor_for %w[reason .md]
end

def cancelled_state_for(thingy)
Expand Down
2 changes: 1 addition & 1 deletion lib/linear/commands/issue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def close_issue(issue, **options)
doing = cancelled ? 'cancelling' : 'closing'
done = cancelled ? 'cancelled' : 'closed'
workflow_state = cancelled ? cancelled_state_for(issue) : completed_state_for(issue)
reason = reason_for(options[:reason], four: "#{doing} #{issue.identifier} - #{issue.title}")
reason = reason_for(options[:reason], four: "#{doing} *#{issue.identifier} - #{issue.title}*")
issue_comment issue, reason
issue.close! state: workflow_state, trash: options[:trash]
prompt.ok "#{issue.identifier} was #{done}"
Expand Down
2 changes: 1 addition & 1 deletion lib/linear/commands/issue/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Update
include Rubyists::Linear::CLI::Issue # for #gimme_da_issue! and other Issue methods
desc 'Update an issue'
argument :issue_ids, type: :array, required: true, desc: 'Issue IDs (i.e. CRY-1)'
option :comment, type: :string, aliases: ['-m'], desc: 'Comment to add to the issue. - openan editor'
option :comment, type: :string, aliases: ['-m'], desc: 'Comment to add to the issue. - open an editor'
option :project, type: :string, aliases: ['-p'], desc: 'Project to move the issue to. - select from a list'
option :cancel, type: :boolean, default: false, desc: 'Cancel the issue'
option :close, type: :boolean, default: false, desc: 'Close the issue'
Expand Down

0 comments on commit 13fd073

Please sign in to comment.