Bugzilla – Attachment 41933 Details for
Bug 14727
koha-indexer tab-completion in bash
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14727: koha-indexer tab completion in bash
Bug-14727-koha-indexer-tab-completion-in-bash.patch (text/plain), 3.13 KB, created by
Tomás Cohen Arazi (tcohen)
on 2015-08-25 15:22:08 UTC
(
hide
)
Description:
Bug 14727: koha-indexer tab completion in bash
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2015-08-25 15:22:08 UTC
Size:
3.13 KB
patch
obsolete
>From 3f20ff21a901de6a3f01dd0ba42d041df135e10e Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 25 Aug 2015 12:17:17 -0300 >Subject: [PATCH] Bug 14727: koha-indexer tab completion in bash > >This patch introduces tab-completion in bash to the koha-indexer >command. It completes using valid option switches and instance names. >It stops completing then -h or --help are issued, and once a command >switch is chosen (either --start, --stop or --restart) it goes ahead >with valid instances completion. > >To test: >- Have a packages install (kohadevbox works) >- Run: > $ . debian/koha-common.bash-completion >- Type > koha-indexer <tab> >- Play with all the options >=> SUCCESS: They work as they should. >- Sign off :-D > >Note: it fixes a small glitch on the plack completion. >--- > debian/koha-common.bash-completion | 40 ++++++++++++++++++++++++++++++++++++-- > 1 file changed, 38 insertions(+), 2 deletions(-) > >diff --git a/debian/koha-common.bash-completion b/debian/koha-common.bash-completion >index d65aba2..637a56b 100644 >--- a/debian/koha-common.bash-completion >+++ b/debian/koha-common.bash-completion >@@ -217,9 +217,9 @@ _koha-plack() > --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'"; ;; >+ substract="$substract -e -q"; ;; > -q) #Â filter the other quiet switches and go on >- substract="$substract -e '--quiet' -e '-q'"; ;; >+ substract="$substract -e --quiet"; ;; > esac > substract="$substract -e ${COMP_WORDS[i]}" > fi >@@ -235,6 +235,42 @@ _koha-plack() > } > complete -F _koha-plack koha-plack > >+_koha-indexer() >+{ >+ local cur opts substract >+ >+ COMPREPLY=() >+ _get_comp_words_by_ref cur >+ opts="--start --stop --restart --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_list_cmd ; return 0 ;; >+ --stop) _koha_list_cmd ; return 0 ;; >+ --restart) _koha_list_cmd ; 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 -q"; ;; >+ -q) #Â filter the other quiet switches and go on >+ substract="$substract -e --quiet"; ;; >+ 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-indexer koha-indexer >+ > # Local variables: > # mode: shell-script > # sh-basic-offset: 4 >-- >2.5.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 14727
:
41933
|
43314
|
43381