Class: Abide::CLI::JiraGetIssueCommand

Inherits:
CmdParse::Command
  • Object
show all
Defined in:
lib/abide_dev_utils/cli/jira.rb

Constant Summary collapse

CMD_NAME =
'get-issue'
CMD_SHORT =
'Gets a specific issue'
CMD_LONG =
'Returns JSON of a specific issue from key (<project>-<num>)'

Instance Method Summary collapse

Constructor Details

#initializeJiraGetIssueCommand

Returns a new instance of JiraGetIssueCommand.



48
49
50
51
52
53
54
# File 'lib/abide_dev_utils/cli/jira.rb', line 48

def initialize
  super(CMD_NAME, takes_commands: false)
  short_desc(CMD_SHORT)
  long_desc(CMD_LONG)
  argument_desc(ISSUE: 'A Jira issue key (<PROJECT>-<NUM>)')
  options.on('-o [FILE]', '--out-file [FILE]', 'Path to save the JSON output') { |o| @data[:file] = o }
end

Instance Method Details

#execute(issue) ⇒ Object



56
57
58
59
60
61
# File 'lib/abide_dev_utils/cli/jira.rb', line 56

def execute(issue)
  issue = AbideDevUtils::Jira.client.find(:issue, issue)
  console = @data[:file].nil?
  out_json = issue.attrs.select { |_, v| !v.nil? || !v.empty? }
  Abide::CLI::OUTPUT.json(out_json, console: console, file: @data[:file])
end