Class: Abide::CLI::JiraGetIssueCommand
- Inherits:
-
CmdParse::Command
- Object
- CmdParse::Command
- Abide::CLI::JiraGetIssueCommand
- 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
- #execute(issue) ⇒ Object
-
#initialize ⇒ JiraGetIssueCommand
constructor
A new instance of JiraGetIssueCommand.
Constructor Details
#initialize ⇒ JiraGetIssueCommand
Returns a new instance of JiraGetIssueCommand.
53 54 55 56 57 58 59 |
# File 'lib/abide_dev_utils/cli/jira.rb', line 53 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>)') .on('-o [FILE]', '--out-file [FILE]', 'Path to save the JSON output') { |o| @data[:file] = o } end |
Instance Method Details
#execute(issue) ⇒ Object
61 62 63 64 65 66 67 |
# File 'lib/abide_dev_utils/cli/jira.rb', line 61 def execute(issue) client = JIRA.client(options: {}) issue = client.Issue.find(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 |