mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-25 23:30:08 +00:00
jira: add completion
This commit is contained in:
parent
7cf892ecaa
commit
dc42e8d488
2 changed files with 25 additions and 4 deletions
21
plugins/jira/_jira
Normal file
21
plugins/jira/_jira
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
#compdef jira
|
||||||
|
#autoload
|
||||||
|
|
||||||
|
local -a _1st_arguments
|
||||||
|
_1st_arguments=(
|
||||||
|
'new:create a new issue'
|
||||||
|
'dashboard:open the dashboard'
|
||||||
|
'reported:search for issues reported by a user'
|
||||||
|
'assigned:search for issues assigned to a user'
|
||||||
|
)
|
||||||
|
|
||||||
|
_arguments -C \
|
||||||
|
':command:->command' \
|
||||||
|
'*::options:->options'
|
||||||
|
|
||||||
|
case $state in
|
||||||
|
(command)
|
||||||
|
_describe -t commands "jira subcommand" _1st_arguments
|
||||||
|
return
|
||||||
|
;;
|
||||||
|
esac
|
|
@ -40,7 +40,7 @@ function jira() {
|
||||||
elif [[ -n "${JIRA_URL}" ]]; then
|
elif [[ -n "${JIRA_URL}" ]]; then
|
||||||
jira_url=${JIRA_URL}
|
jira_url=${JIRA_URL}
|
||||||
else
|
else
|
||||||
jira_url_help
|
_jira_url_help
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ function jira() {
|
||||||
echo "Opening new issue"
|
echo "Opening new issue"
|
||||||
open_command "${jira_url}/secure/CreateIssue!default.jspa"
|
open_command "${jira_url}/secure/CreateIssue!default.jspa"
|
||||||
elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then
|
elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then
|
||||||
jira_query $@
|
_jira_query $@
|
||||||
elif [[ "$action" == "dashboard" ]]; then
|
elif [[ "$action" == "dashboard" ]]; then
|
||||||
echo "Opening dashboard"
|
echo "Opening dashboard"
|
||||||
open_command "${jira_url}/secure/Dashboard.jspa"
|
open_command "${jira_url}/secure/Dashboard.jspa"
|
||||||
|
@ -82,7 +82,7 @@ function jira() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function jira_url_help() {
|
function _jira_url_help() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
JIRA url is not specified anywhere.
|
JIRA url is not specified anywhere.
|
||||||
Valid options, in order of precedence:
|
Valid options, in order of precedence:
|
||||||
|
@ -92,7 +92,7 @@ Valid options, in order of precedence:
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
function jira_query() {
|
function _jira_query() {
|
||||||
local verb="$1"
|
local verb="$1"
|
||||||
local jira_name lookup preposition query
|
local jira_name lookup preposition query
|
||||||
if [[ "${verb}" == "reported" ]]; then
|
if [[ "${verb}" == "reported" ]]; then
|
||||||
|
|
Loading…
Reference in a new issue