[Koha-bugs] [Bug 10003] koha-* scripts (packages) should provide tab-completion in bash

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Oct 30 16:40:08 CET 2013


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10003

Tomás Cohen Arazi <tomascohen at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #20743|0                           |1
        is obsolete|                            |

--- Comment #7 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
Created attachment 22609
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=22609&action=edit
Bug 10003: bash-completion for koha-list and some other script

This is an initial commit submitted for peer review. It implements
bash-completion for the following commands:

 - koha-list
 - koha-enable
 - koha-disable
 - koha-email-enable
 - koha-email-disable
 - koha-enable-sip
 - koha-start-sip
 - koha-restart-sip
 - koha-stop-sip
 - koha-start-zebra
 - koha-stop-zebra
 - koha-restart-zebra

It is implemented in a way that it removes already used or mutually exclusive
parameters (instance names, option switches).
I already have written completion for other (more complex) commands, But I
belive a simpler patch is better to start with.

IMPORTANT: this patch relies on having the koha-list command available in the
path. Also 10622 is needed for the SIP-related option switches.

To test:
 - Make sure you have bash-completion installed and enabled (IRC might help us
if you encounter problems).
 - Apply the patch.
Option 1:
 - Pick the debian/koha-common.bash-completion file and do
   $ cp debian/koha-common.bash-completion /etc/bash_completion.d/koha-common
 - Open a new bash shell (I do it opening a new terminal on my Ubuntu box).
 - Type one of the listed commands...
  And repeatedly press <TAB>.
 - Enjoy, and signoff if you belive it is usable. Otherwise report back.
Option 2:
 - run:
   $ . debian/koha-common.bash-completion
 - Type one of the listed commands...
  And repeatedly press <TAB>.
 - Enjoy, and signoff if you belive it is usable. Otherwise report back.

Tests:
- Some koha-list option switches are mutually exclusive, -h should be available
in any context
- koha-enable should only autocomplete disabled instances
- koha-disable should only autocomplete enabled instances
- koha-email-enable should only autocomplete email-disabled instances
- koha-email-disable should only autocomplete email-enabled instances
- koha-*-zebra scripts should only autocomplete enabled instances.
- koha-*-sip scripts should only autocomplete sip-enabled instances.

Regards
To+

Note: writing bash-completion routines is a bit hacky, I tried to make it the
simplest way I could. Your comments are welcome.

Sponsored-by: Universidad Nacional de Cordoba

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list