Class: Peekj::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/peekj/cli.rb

Instance Method Summary collapse

Instance Method Details

#comment(issue_key = nil) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/peekj/cli.rb', line 44

def comment(issue_key=nil)
  issue_key = current_branch_issue_key if options['current_branch']

  add_comment_succeeded = JiraApi.add_comment(issue_key, ask('Comment:', [:red, :bold]))

  if add_comment_succeeded
    say('Comment added succesfully', [:green, :bold])
  else
    say('Error', [:red, :bold])
  end
end

#loginObject



7
8
9
10
11
12
13
# File 'lib/peekj/cli.rb', line 7

def 
  Credentials::KEYS.each do |credential_key|
    credential_value = ask("#{credential_key}:")

    Credentials.send("#{credential_key}=", credential_value)
  end
end

#summary(issue_key = nil) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/peekj/cli.rb', line 19

def summary(issue_key=nil)
  issue_key = current_branch_issue_key if options['current_branch']

  issue = JiraApi.get_issue(issue_key)

  say("#{issue_key} ", [:bold, :red])
  say("(#{issue.status})", [:bold, :magenta])
  say(issue.summary)

  unless options['short']
    say('Description:', [:bold, :red])
    say(issue.description)
  end

  if options['long']
    say('Comments:', [:bold, :red])
    issue.comments.each do |comment|
      say("#{comment[:author]}: ", [:yellow])
      say(comment[:body])
    end
  end
end