Bugzilla – Attachment 84513 Details for
Bug 18562
Add koha-sip script to handle SIP servers for instances
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18562: Tab completion in bash
Bug-18562-Tab-completion-in-bash.patch (text/plain), 2.48 KB, created by
Tomás Cohen Arazi (tcohen)
on 2019-01-30 12:22:45 UTC
(
hide
)
Description:
Bug 18562: Tab completion in bash
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2019-01-30 12:22:45 UTC
Size:
2.48 KB
patch
obsolete
>From 3951f548b85c7dbfd3ec2933add79960bde40112 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 30 Jan 2019 09:12:36 -0300 >Subject: [PATCH] Bug 18562: Tab completion in bash > >This patch adds the fancy tab completion in bash. > >To test: >- Run: > $ source debian/koha-common.bash-completion > $ sudo koha-sip <tab> >- Play with all the options >=> SUCCESS: The combinations make sense (e.g. only SIP-enabled instances > are completed for --start, --stop, --restart, -v and --verbose are not > offered if the other one is already in there, --enable only applies to > SIP-disabled instances, etc). >- Sign off :-D >--- > debian/koha-common.bash-completion | 38 ++++++++++++++++++++++++++++++ > 1 file changed, 38 insertions(+) > >diff --git a/debian/koha-common.bash-completion b/debian/koha-common.bash-completion >index 276cba07c9..56b428d447 100644 >--- a/debian/koha-common.bash-completion >+++ b/debian/koha-common.bash-completion >@@ -303,6 +303,44 @@ _koha-zebra() > } > complete -F _koha-zebra koha-zebra > >+_koha-sip() >+{ >+ local cur opts substract >+ >+ COMPREPLY=() >+ _get_comp_words_by_ref cur >+ opts="--start --stop --restart --status --enable --verbose -v --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_sip_enabled_instances ; return 0 ;; >+ --stop) _koha_sip_enabled_instances ; return 0 ;; >+ --restart) _koha_sip_enabled_instances ; return 0 ;; >+ --status) _koha_sip_enabled_instances ; return 0 ;; >+ --enable) _koha_sip_disabled ; return 0 ;; >+ --help) COMPREPLY=() ; return 0 ;; #Â no more completions >+ -h) COMPREPLY=() ; return 0 ;; #Â no more completions >+ --verbose) #Â filter the other quiet switches and go on >+ substract="$substract -e -q"; ;; >+ -v) #Â filter the other quiet switches and go on >+ substract="$substract -e --verbose"; ;; >+ 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-sip koha-sip >+ > # Local variables: > # mode: shell-script > # sh-basic-offset: 4 >-- >2.20.1
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 18562
:
84511
|
84512
|
84513
|
84521
|
84522
|
84523
|
84951
|
84952
|
84953