Bugzilla – Attachment 41753 Details for
Bug 13791
Plack - Out of the box support on packages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13791: tab-completion for koha-plack in bash
Bug-13791-tab-completion-for-koha-plack-in-bash.patch (text/plain), 3.88 KB, created by
Jonathan Druart
on 2015-08-21 08:36:52 UTC
(
hide
)
Description:
Bug 13791: tab-completion for koha-plack in bash
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2015-08-21 08:36:52 UTC
Size:
3.88 KB
patch
obsolete
>From bd3ee7c0b0cd9c2015c9f0e726787ad0c42eeb4d Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 14 Aug 2015 18:24:20 -0300 >Subject: [PATCH] Bug 13791: tab-completion for koha-plack in bash > >This patch adds tab-completion in bash for the koha-plack command. > >After the --start, --stop, --restart and --disable switches it only offers >plack-enabled instances. And disabled instances to --enable. > >--help and -h just finish end the completion. > >--quiet and -q are trickier to implement. They will work (be offered) >only before the action switches. > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > debian/koha-common.bash-completion | 59 ++++++++++++++++++++++++++++++++++++-- > 1 file changed, 57 insertions(+), 2 deletions(-) > >diff --git a/debian/koha-common.bash-completion b/debian/koha-common.bash-completion >index 934e279..07bcdc1 100644 >--- a/debian/koha-common.bash-completion >+++ b/debian/koha-common.bash-completion >@@ -56,10 +56,11 @@ _koha_list_cmd() > if [[ "$substract" != "" ]]; then > instancelist=$( koha-list $filter | grep -v -x $substract ) > else >- instancelist=$( koha-list $filer ) >+ instancelist=$( koha-list $filter ) > fi > > COMPREPLY=( $(compgen -W "$instancelist" -- $cur ) ) >+ return 0 > } > > _koha_email_disable() >@@ -125,7 +126,7 @@ _koha_list() > > COMPREPLY=() > _get_comp_words_by_ref cur >- opts="--enabled --disabled --email --noemail --sip --nosip --help -h" >+ opts="--enabled --disabled --email --noemail --plack --noplack --sip --nosip --help -h" > > # Build a list of the already used option switches > for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do >@@ -139,6 +140,10 @@ _koha_list() > substract="$substract -e --noemail"; ;; > --noemail) > substract="$substract -e --email"; ;; >+ --plack) >+ substract="$substract -e --noplack"; ;; >+ --noplack) >+ substract="$substract -e --plack"; ;; > --sip) > substract="$substract -e --nosip"; ;; > --nosip) >@@ -162,6 +167,56 @@ _koha_list() > } > complete -F _koha_list koha-list > >+_koha_plack_instances() >+{ >+ _koha_list_cmd "--plack" >+ return 0 >+} >+ >+_koha_noplack_instances() >+{ >+ _koha_list_cmd "--noplack" >+ return 0 >+} >+ >+_koha-plack() >+{ >+ local cur opts substract >+ >+ COMPREPLY=() >+ _get_comp_words_by_ref cur >+ opts="--start --stop --restart --enable --disable --quiet -q --help -h" >+ >+ # Build a list of the already used option switches >+ for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do >+ if [[ ${COMP_WORDS[i]} == -* ]]; then >+ case ${COMP_WORDS[i]} in >+ --start) _koha_plack_instances ; return 0 ;; >+ --stop) _koha_plack_instances ; return 0 ;; >+ --restart) _koha_plack_instances ; return 0 ;; >+ --enable) _koha_noplack_instances ; return 0 ;; >+ --disable) _koha_plack_instances ; return 0 ;; >+ --help) COMPREPLY=() ; return 0 ;; #Â no more completions >+ -h) COMPREPLY=() ; return 0 ;; #Â no more completions >+ --quiet) #Â filter the other quiet switches and go on >+ substract="$substract -e '--quiet' -e '-q'"; ;; >+ -q) #Â filter the other quiet switches and go on >+ substract="$substract -e '--quiet' -e '-q'"; ;; >+ esac >+ substract="$substract -e ${COMP_WORDS[i]}" >+ fi >+ done >+ >+ if [[ "$substract" != "" ]]; then >+ opts=$( echo $opts | sed -e 's/ /\n/g' | grep -v -x $substract ) >+ fi >+ >+ COMPREPLY=( $(compgen -W "$opts" -- $cur ) ) >+ >+ return 0 >+} >+complete -F _koha-plack koha-plack >+ > # Local variables: > # mode: shell-script > # sh-basic-offset: 4 >-- >2.1.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13791
:
41481
|
41482
|
41483
|
41484
|
41485
|
41486
|
41503
|
41504
|
41505
|
41506
|
41507
|
41508
|
41509
|
41510
|
41511
|
41512
|
41513
|
41563
|
41564
|
41565
|
41566
|
41567
|
41568
|
41571
|
41572
|
41573
|
41574
|
41575
|
41576
|
41748
|
41749
|
41750
|
41751
|
41752
| 41753 |
41866
|
42038