diff options
author | Andrew Janke <andrew@apjanke.net> | 2015-08-18 05:05:54 -0400 |
---|---|---|
committer | Andrew Janke <andrew@apjanke.net> | 2015-08-18 05:05:54 -0400 |
commit | dc42e8d488d7b7b5285e71947940c7d6fb19355b (patch) | |
tree | 9d1e9b7d77f621ca056aad95ef690e2d0289b848 | |
parent | 7cf892ecaa86f064aa3f78b9d5bee3b7db208ca4 (diff) | |
download | zsh-dc42e8d488d7b7b5285e71947940c7d6fb19355b.tar.gz zsh-dc42e8d488d7b7b5285e71947940c7d6fb19355b.tar.bz2 zsh-dc42e8d488d7b7b5285e71947940c7d6fb19355b.zip |
jira: add completion
-rw-r--r-- | plugins/jira/_jira | 21 | ||||
-rw-r--r-- | plugins/jira/jira.plugin.zsh | 8 |
2 files changed, 25 insertions, 4 deletions
diff --git a/plugins/jira/_jira b/plugins/jira/_jira new file mode 100644 index 000000000..b0ea658e2 --- /dev/null +++ b/plugins/jira/_jira @@ -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 diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index a10feec3e..89559767f 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -40,7 +40,7 @@ function jira() { elif [[ -n "${JIRA_URL}" ]]; then jira_url=${JIRA_URL} else - jira_url_help + _jira_url_help return 1 fi @@ -59,7 +59,7 @@ function jira() { echo "Opening new issue" open_command "${jira_url}/secure/CreateIssue!default.jspa" elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then - jira_query $@ + _jira_query $@ elif [[ "$action" == "dashboard" ]]; then echo "Opening dashboard" open_command "${jira_url}/secure/Dashboard.jspa" @@ -82,7 +82,7 @@ function jira() { fi } -function jira_url_help() { +function _jira_url_help() { cat << EOF JIRA url is not specified anywhere. Valid options, in order of precedence: @@ -92,7 +92,7 @@ Valid options, in order of precedence: EOF } -function jira_query() { +function _jira_query() { local verb="$1" local jira_name lookup preposition query if [[ "${verb}" == "reported" ]]; then |