From 576d25f9360fa8956784c723e0c0e007b1386382 Mon Sep 17 00:00:00 2001 From: andykuszyk Date: Thu, 26 Sep 2024 11:08:22 +0100 Subject: [PATCH] Added view command --- README.org | 10 +++++++++- ob-jira-markdown.el | 12 ++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/README.org b/README.org index 72fe06f..bab09a3 100644 --- a/README.org +++ b/README.org @@ -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~. diff --git a/ob-jira-markdown.el b/ob-jira-markdown.el index 945fa22..ab25936 100644 --- a/ob-jira-markdown.el +++ b/ob-jira-markdown.el @@ -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\"")))))