From 9f31951019401449e057a236886d133f58c5cc64 Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 9 Jan 2023 13:30:08 -0600 Subject: fix(jira): Make prefix check on "jira branch" command case-insensitive (#8799) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Make prefix check on "jira branch" command case-insensitive * Update plugins/jira/jira.plugin.zsh Co-authored-by: Marc Cornellà * Fixing tabs to spaces Co-authored-by: Robby Russell Co-authored-by: Marc Cornellà --- plugins/jira/README.md | 5 +++++ plugins/jira/jira.plugin.zsh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'plugins/jira') diff --git a/plugins/jira/README.md b/plugins/jira/README.md index a5633af77..f8751aaa2 100644 --- a/plugins/jira/README.md +++ b/plugins/jira/README.md @@ -27,6 +27,11 @@ jira branch # opens an existing issue matching the current branch name # The branch name may have prefixes ending in "/": "feature/MP-1234", # and also suffixes starting with "_": "MP-1234_fix_dashboard" # In both these cases, the issue opened will be "MP-1234" + # This is also checks if the prefix is in the name, and adds it if not, so: + # "MP-1234" opens the issue "MP-1234", + # "mp-1234" opens the issue "mp-1234", + # and "1234" opens the issue "MP-1234". +# NOTE: since jira is case insensitive, the first two examples open the same issue jira ABC-123 # opens an existing issue jira ABC-123 m # opens an existing issue for adding a comment ``` diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 22807e0ae..37d7b6a27 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -75,7 +75,7 @@ function jira() { # Strip suffixes starting with _ issue_arg=(${(s:_:)issue_arg}) issue_arg=${issue_arg[1]} - if [[ "$issue_arg" = ${jira_prefix}* ]]; then + if [[ "${issue_arg:l}" = ${jira_prefix:l}* ]]; then issue="${issue_arg}" else issue="${jira_prefix}${issue_arg}" -- cgit v1.2.3-70-g09d2 From fc722807f815bd170849f92d215ce2afa62e55b6 Mon Sep 17 00:00:00 2001 From: August Feng <46177585+augustfengd@users.noreply.github.com> Date: Mon, 9 Jan 2023 14:43:42 -0500 Subject: refactor(jira)!: rename myissues to mine and add completion (#10931) --- plugins/jira/README.md | 2 +- plugins/jira/_jira | 1 + plugins/jira/jira.plugin.zsh | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'plugins/jira') diff --git a/plugins/jira/README.md b/plugins/jira/README.md index f8751aaa2..a7cfe6d9e 100644 --- a/plugins/jira/README.md +++ b/plugins/jira/README.md @@ -18,11 +18,11 @@ This plugin supplies one command, `jira`, through which all its features are exp jira # performs the default action jira new # opens a new issue +jira mine # queries for your own issues jira dashboard # opens your JIRA dashboard 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 myissues # queries for you own issues jira branch # opens an existing issue matching the current branch name # The branch name may have prefixes ending in "/": "feature/MP-1234", # and also suffixes starting with "_": "MP-1234_fix_dashboard" diff --git a/plugins/jira/_jira b/plugins/jira/_jira index 1ac3eeda3..0e37b7e9d 100644 --- a/plugins/jira/_jira +++ b/plugins/jira/_jira @@ -4,6 +4,7 @@ local -a _1st_arguments _1st_arguments=( 'new:create a new issue' + 'mine:open my issues' 'dashboard:open the dashboard' 'tempo:open the tempo' 'reported:search for issues reported by a user' diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 37d7b6a27..0add040d1 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -44,7 +44,7 @@ function jira() { open_command "${jira_url}/secure/CreateIssue!default.jspa" elif [[ "$action" == "assigned" || "$action" == "reported" ]]; then _jira_query ${@:-$action} - elif [[ "$action" == "myissues" ]]; then + elif [[ "$action" == "mine" ]]; then echo "Opening my issues" open_command "${jira_url}/issues/?filter=-1" elif [[ "$action" == "dashboard" ]]; then -- cgit v1.2.3-70-g09d2 From 585084354e7ecf3b93c6eedb2ece70e914ee28b9 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 9 Jan 2023 21:45:20 +0200 Subject: feat(jira): add optional plugin "tempo" path (#11121) CHANGE: added new environment variable JIRA_TEMPO_PATH to allow set an optional path Co-authored-by: Vladimir Antoscenco --- plugins/jira/README.md | 1 + plugins/jira/jira.plugin.zsh | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'plugins/jira') diff --git a/plugins/jira/README.md b/plugins/jira/README.md index a7cfe6d9e..3d6d323a4 100644 --- a/plugins/jira/README.md +++ b/plugins/jira/README.md @@ -68,6 +68,7 @@ echo "https://jira.atlassian.com" >> .jira-url * `$JIRA_PREFIX` - Prefix added to issue ID arguments * `$JIRA_RAPID_BOARD` - Set to `true` if you use Rapid Board * `$JIRA_DEFAULT_ACTION` - Action to do when `jira` is called with no arguments; defaults to "new" +* `$JIRA_TEMPO_PATH` - Your JIRA tempo url path; defaults to "/secure/Tempo.jspa" ### Browser ### diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 0add040d1..71224bdfb 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -56,13 +56,18 @@ function jira() { fi elif [[ "$action" == "tempo" ]]; then echo "Opening tempo" - open_command "${jira_url}/secure/Tempo.jspa" + if [[ -n "$JIRA_TEMPO_PATH" ]]; then + open_command "${jira_url}${JIRA_TEMPO_PATH}" + else + open_command "${jira_url}/secure/Tempo.jspa" + fi elif [[ "$action" == "dumpconfig" ]]; then echo "JIRA_URL=$jira_url" echo "JIRA_PREFIX=$jira_prefix" echo "JIRA_NAME=$JIRA_NAME" echo "JIRA_RAPID_BOARD=$JIRA_RAPID_BOARD" echo "JIRA_DEFAULT_ACTION=$JIRA_DEFAULT_ACTION" + echo "JIRA_TEMPO_PATH=$JIRA_TEMPO_PATH" else # Anything that doesn't match a special action is considered an issue name # but `branch` is a special case that will parse the current git branch -- cgit v1.2.3-70-g09d2 From e0d0dfb845a8f1eb35bce8ca5afcd76cb2ffbb35 Mon Sep 17 00:00:00 2001 From: Arnaud Zheng Date: Mon, 9 Jan 2023 20:53:32 +0100 Subject: feat(jira): support rapid view on rapid board mode (#9459) * feat(jira): support rapid view on rapid board mode * Update README to clarify how the rapid board/view works Co-authored-by: Robby Russell --- plugins/jira/README.md | 3 ++- plugins/jira/jira.plugin.zsh | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'plugins/jira') diff --git a/plugins/jira/README.md b/plugins/jira/README.md index 3d6d323a4..5dc5bfc96 100644 --- a/plugins/jira/README.md +++ b/plugins/jira/README.md @@ -18,8 +18,8 @@ This plugin supplies one command, `jira`, through which all its features are exp jira # performs the default action jira new # opens a new issue +jira dashboard [rapid_view] # opens your JIRA dashboard jira mine # queries for your own issues -jira dashboard # opens your JIRA dashboard 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 @@ -67,6 +67,7 @@ echo "https://jira.atlassian.com" >> .jira-url * `$JIRA_NAME` - Your JIRA username; used as the default user for `assigned`/`reported` searches * `$JIRA_PREFIX` - Prefix added to issue ID arguments * `$JIRA_RAPID_BOARD` - Set to `true` if you use Rapid Board +* `$JIRA_RAPID_VIEW` - Set the default rapid view; it doesn't work if `$JIRA_RAPID_BOARD` is set to false * `$JIRA_DEFAULT_ACTION` - Action to do when `jira` is called with no arguments; defaults to "new" * `$JIRA_TEMPO_PATH` - Your JIRA tempo url path; defaults to "/secure/Tempo.jspa" diff --git a/plugins/jira/jira.plugin.zsh b/plugins/jira/jira.plugin.zsh index 71224bdfb..e789fce92 100644 --- a/plugins/jira/jira.plugin.zsh +++ b/plugins/jira/jira.plugin.zsh @@ -50,7 +50,7 @@ function jira() { elif [[ "$action" == "dashboard" ]]; then echo "Opening dashboard" if [[ "$JIRA_RAPID_BOARD" == "true" ]]; then - open_command "${jira_url}/secure/RapidBoard.jspa" + _jira_rapid_board ${@} else open_command "${jira_url}/secure/Dashboard.jspa" fi @@ -65,6 +65,7 @@ function jira() { echo "JIRA_URL=$jira_url" echo "JIRA_PREFIX=$jira_prefix" echo "JIRA_NAME=$JIRA_NAME" + echo "JIRA_RAPID_VIEW=$JIRA_RAPID_VIEW" echo "JIRA_RAPID_BOARD=$JIRA_RAPID_BOARD" echo "JIRA_DEFAULT_ACTION=$JIRA_DEFAULT_ACTION" echo "JIRA_TEMPO_PATH=$JIRA_TEMPO_PATH" @@ -112,6 +113,16 @@ Valid options, in order of precedence: EOF } +function _jira_rapid_board() { + rapid_view=${2:=$JIRA_RAPID_VIEW} + + if [[ -z $rapid_view ]]; then + open_command "${jira_url}/secure/RapidBoard.jspa" + else + open_command "${jira_url}/secure/RapidBoard.jspa?rapidView=$rapid_view" + fi +} + function _jira_query() { emulate -L zsh local verb="$1" -- cgit v1.2.3-70-g09d2 From 046f0ca5571e28aa328566d5f81a338e074cf174 Mon Sep 17 00:00:00 2001 From: Robby Russell Date: Mon, 9 Jan 2023 20:25:08 +0000 Subject: fix(jira): Update README examples to a table format --- plugins/jira/README.md | 46 +++++++++++++++++++++++++--------------------- 1 file changed, 25 insertions(+), 21 deletions(-) (limited to 'plugins/jira') diff --git a/plugins/jira/README.md b/plugins/jira/README.md index 5dc5bfc96..d78ea15a4 100644 --- a/plugins/jira/README.md +++ b/plugins/jira/README.md @@ -14,27 +14,31 @@ In this document, "JIRA" refers to the JIRA issue tracking server, and `jira` re This plugin supplies one command, `jira`, through which all its features are exposed. Most forms of this command open a JIRA page in your web browser. -``` -jira # performs the default action - -jira new # opens a new issue -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 - # The branch name may have prefixes ending in "/": "feature/MP-1234", - # and also suffixes starting with "_": "MP-1234_fix_dashboard" - # In both these cases, the issue opened will be "MP-1234" - # This is also checks if the prefix is in the name, and adds it if not, so: - # "MP-1234" opens the issue "MP-1234", - # "mp-1234" opens the issue "mp-1234", - # and "1234" opens the issue "MP-1234". -# NOTE: since jira is case insensitive, the first two examples open the same issue -jira ABC-123 # opens an existing issue -jira ABC-123 m # opens an existing issue for adding a comment -``` +## Commands + +| 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 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 Branch usage notes + +The branch name may have prefixes ending in "/": "feature/MP-1234", and also suffixes +starting with "_": "MP-1234_fix_dashboard". In both these cases, the issue opened will be "MP-1234" + +This is also checks if the prefix is in the name, and adds it if not, so: "MP-1234" opens the issue "MP-1234", +"mp-1234" opens the issue "mp-1234", and "1234" opens the issue "MP-1234". + + #### Debugging usage #### -- cgit v1.2.3-70-g09d2