Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(jira): add help/usage cmd #12293

Merged
merged 4 commits into from Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion plugins/jira/README.md
Expand Up @@ -16,18 +16,21 @@ This plugin supplies one command, `jira`, through which all its features are exp

## Commands

`jira help` or `jira usage` will print the below usage instructions

| Command | Description |
| :------------ | :-------------------------------------------------------- |
| `jira` | Performs the default action |
| `jira new` | Opens a new Jira issue dialogue |
| `jira ABC-123` | Opens an existing issue |
| `jira ABC-123 m` | Opens an existing issue for adding a comment |
| `jira dashboard [rapid_view]` | # opens your JIRA dashboard |
| `jira dashboard [rapid_view]` | Opens your JIRA dashboard |
| `jira mine` | Queries for your own issues |
| `jira tempo` | Opens your JIRA Tempo |
| `jira reported [username]` | Queries for issues reported by a user |
| `jira assigned [username]` | Queries for issues assigned to a user |
| `jira branch` | Opens an existing issue matching the current branch name |
| `jira help` | Prints usage instructions |


### Jira Branch usage notes
Expand Down
1 change: 1 addition & 0 deletions plugins/jira/_jira
Expand Up @@ -11,6 +11,7 @@ _1st_arguments=(
'assigned:search for issues assigned to a user'
'branch:open the issue named after the git branch of the current directory'
'dumpconfig:display effective jira configuration'
'help:print usage help to stdout'
)

_arguments -C \
Expand Down
17 changes: 17 additions & 0 deletions plugins/jira/jira.plugin.zsh
Expand Up @@ -2,6 +2,21 @@
#
# See README.md for details

function usage() {
carlosala marked this conversation as resolved.
Show resolved Hide resolved
cat <<EOF
jira Performs the default action
jira new Opens a new Jira issue dialogue
jira ABC-123 Opens an existing issue
jira ABC-123 m Opens an existing issue for adding a comment
jira dashboard [rapid_view] Opens your JIRA dashboard
jira mine Queries for your own issues
jira tempo Opens your JIRA Tempo
jira reported [username] Queries for issues reported by a user
jira assigned [username] Queries for issues assigned to a user
jira branch Opens an existing issue matching the current branch name
EOF
}

function jira() {
emulate -L zsh
local action jira_url jira_prefix
Expand Down Expand Up @@ -44,6 +59,8 @@ function jira() {
open_command "${jira_url}/secure/CreateIssue!default.jspa"
elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then
_jira_query ${@:-$action}
elif [[ "$action" == "help" || "$action" == "usage" ]]; then
usage
carlosala marked this conversation as resolved.
Show resolved Hide resolved
elif [[ "$action" == "mine" ]]; then
echo "Opening my issues"
open_command "${jira_url}/issues/?filter=-1"
Expand Down