From bd5f9232dbf531ca4eee18c93bdc20c05e3df9f2 Mon Sep 17 00:00:00 2001 From: Peter Yates Date: Thu, 2 May 2013 16:04:23 +0100 Subject: [PATCH 1/4] Added completion for ralio, a rally client --- src/_ralio | 122 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 src/_ralio diff --git a/src/_ralio b/src/_ralio new file mode 100644 index 0000000..ef19c5d --- /dev/null +++ b/src/_ralio @@ -0,0 +1,122 @@ +#compdef ralio + +# ZSH completion for ralio +# +# https://github.com/oesmith/ralio +# +# Author +# +# Peter Yates + +_ralio () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' \ + + case $state in + (command) + + local -a subcommands + subcommands=( + "backlog:Show the product backlog" + "sprint:Show the current team iteration" + "show:Show related information for an individual story, defect or task" + "open:Open a story, defect or task in a web browser" + "start:Set a task, defect or story state to in-progress and assign it to you" + "finish:Set a task, defect or story state to completed and assign it to you" + "abandon:Set a task, defect or story state to defined and clear the owner" + "block:Set a task, defect or story state to blocked" + "unblock:Set a task, defect or story state to unblocked" + "current:Show your current tasks and stories" + "point:Set the points for a story or defect" + "task:Allow you to create and delete story tasks." + "configure:Set your Rally configurations." + ) + _describe -t commands 'git flow' subcommands + + _arguments -C \ + {-V,--version}"[display version information]" \ + {-h,--help}"[output usage information]" + ;; + + (options) + case $line[1] in + + + (sprint) + _arguments \ + "-t[Show tasks]" \ + "-p[Project name]" \ + "-f[Filter results]" + ;; + + (start | finish) + _arguments \ + '--pair[Pair programming partner]' \ + "--resolution[Resolution status]" \ + "--rootcause[Root cause]" + ;; + + (create | delete) + _arguments \ + "-n[Name of the task]" \ + "-t[Task - I don't know what this does!]" + ;; + + + (task) + __ralio-task + ;; + + esac + ;; + esac +} + +__ralio-task () +{ + local curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -C \ + ':command:->command' \ + '*::options:->options' + + case $state in + (command) + + local -a subcommands + subcommands=( + "create:Create a new task" + "delete:Delete a task" + ) + _describe -t commands 'ralio task' subcommands + ;; + + (options) + case $line[1] in + + (create|delete) + _arguments \ + -n"[Name of the task]" \ + -t"[Task - I don't know what this does]" # TODO fix this! + ;; + + esac + ;; + esac +} + +_ralio "$@" + +# Local Variables: +# mode: Shell-Script +# sh-indentation: 2 +# indent-tabs-mode: nil +# sh-basic-offset: 2 +# End: +# vim: ft=zsh sw=2 ts=2 et From 2a8463b81420db0fd09455e0643dfc723499d2f6 Mon Sep 17 00:00:00 2001 From: Peter Yates Date: Thu, 2 May 2013 16:28:39 +0100 Subject: [PATCH 2/4] Remove superfluous create/delete options --- src/_ralio | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/_ralio b/src/_ralio index ef19c5d..07ff101 100644 --- a/src/_ralio +++ b/src/_ralio @@ -61,13 +61,6 @@ _ralio () "--rootcause[Root cause]" ;; - (create | delete) - _arguments \ - "-n[Name of the task]" \ - "-t[Task - I don't know what this does!]" - ;; - - (task) __ralio-task ;; From 5977c9427533f0e3656064cb581e12fc78c5ca59 Mon Sep 17 00:00:00 2001 From: Peter Yates Date: Thu, 2 May 2013 16:30:43 +0100 Subject: [PATCH 3/4] Specify the help text for the -t option --- src/_ralio | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/_ralio b/src/_ralio index 07ff101..45c63ef 100644 --- a/src/_ralio +++ b/src/_ralio @@ -95,8 +95,8 @@ __ralio-task () (create|delete) _arguments \ - -n"[Name of the task]" \ - -t"[Task - I don't know what this does]" # TODO fix this! + -n"[Name of the new task]" \ + -t"[Name of the parent task]" ;; esac From e737b496a7032e2d6c05c48befe464406a569203 Mon Sep 17 00:00:00 2001 From: Peter Yates Date: Wed, 22 May 2013 10:15:37 +0100 Subject: [PATCH 4/4] Removed reference to git flow --- src/_ralio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_ralio b/src/_ralio index 45c63ef..7c35552 100644 --- a/src/_ralio +++ b/src/_ralio @@ -36,7 +36,7 @@ _ralio () "task:Allow you to create and delete story tasks." "configure:Set your Rally configurations." ) - _describe -t commands 'git flow' subcommands + _describe -t commands 'ralio commands' subcommands _arguments -C \ {-V,--version}"[display version information]" \