Skip to content

Commit

Permalink
Added view command
Browse files Browse the repository at this point in the history
  • Loading branch information
andykuszyk committed Sep 26, 2024
1 parent a578e1f commit 576d25f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
10 changes: 9 additions & 1 deletion README.org
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,18 @@ Issues can be edited as follows:
this is a test
,#+end_src
#+end_src
*** Viewing Jira issues
An issue can be viewed from a source block as follows:
#+begin_src org
,#+begin_src jira-markdown :command view :execute cli :issue abc-123
,#+end_src
#+end_src

When this source block is executed, the results will be the content of the issue ~abc-123~.
*** Header arguments
The following header arguments are supported:

- :command :: Controls whether issues are created or edited. Valid values are ~create~ and ~edit~.
- :command :: Controls whether issues are created or edited. Valid values are ~create~, ~edit~, and ~view~.
- :execute :: Controls whether the Jira CLI command should be executed, or outputted as a script. Valid values are ~cli~ to execute the command, and ~script~ to output the script. Use ~script~ if you want to preview the CLI command before executing it with ~cli~.
- :title :: The title of the Jira issue.
- :issue :: The issue key of the issue. Required for ~:command edit~, and must be omitted for ~:command create~.
Expand Down
12 changes: 12 additions & 0 deletions ob-jira-markdown.el
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@
jira-cli-cmd)
(t
(error ":execute must be \"cli\" or \"script\"")))))
((string= command "view")
(if (not issue)
(error ":issue must be set to view an issue"))
(let ((jira-cli-cmd
(format "jira issue view %s" issue)))
(cond
((string= execute "cli")
(shell-command-to-string jira-cli-cmd))
((string= execute "script")
jira-cli-cmd)
(t
(error ":issue must be set to view an issue")))))
(t
(error ":command must be \"create\" or \"edit\"")))))

Expand Down

0 comments on commit 576d25f

Please sign in to comment.