Bug 14727

Summary: koha-indexer tab-completion in bash
Product: Koha Reporter: Tomás Cohen Arazi (tcohen) <tomascohen>
Component: Command-line UtilitiesAssignee: Tomás Cohen Arazi (tcohen) <tomascohen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: barton, jonathan.druart, robin, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15011
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 14714    
Bug Blocks:    
Attachments: Bug 14727: koha-indexer tab completion in bash
Bug 14727: koha-indexer tab completion in bash
Bug 14727: koha-indexer tab completion in bash

Description Tomás Cohen Arazi (tcohen) 2015-08-25 15:16:42 UTC
The koha-indexer script should provide tab-completion in bash, as other scripts do.
Comment 1 Tomás Cohen Arazi (tcohen) 2015-08-25 15:22:08 UTC Comment hidden (obsolete)
Comment 2 Jesse Weaver 2015-10-10 00:13:30 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2015-10-13 11:54:55 UTC
Created attachment 43381 [details] [review]
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.

Signed-off-by: Jesse Weaver <pianohacker@gmail.com>
Verified working, including filtering out already used options and
instances.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 4 Jonathan Druart 2015-10-13 11:56:24 UTC
The completion works but:

root@kohadevbox:~# koha-indexer --start kohadev 
[ ok ] Starting Koha indexing daemon for kohadev:.
root@kohadevbox:~# koha-indexer --stop kohadev 
[FAIL] Error: Indexer not running for kohadev: failed!

root@kohadevbox:~# ps aux | grep zebra
kohadev+   509  0.0  0.0  18596   188 ?        S    11:45   0:00 daemon --name=kohadev-koha-zebra --pidfiles=/var/run/koha/kohadev/ --errlog=/var/log/koha/kohadev/zebra-error.log --stdout=/var/log/koha/kohadev/zebra.log --output=/var/log/koha/kohadev/zebra-output.log --verbose=1 --respawn --delay=30 --user=kohadev-koha.kohadev-koha -- zebrasrv -v none,fatal,warn -f /etc/koha/sites/kohadev/koha-conf.xml
kohadev+   511  0.0  0.8 121780  9148 ?        S    11:45   0:00 zebrasrv -v none,fatal,warn -f /etc/koha/sites/kohadev/koha-conf.xml
kohadev+  3017  0.0  0.0  18596   188 ?        S    11:52   0:00 daemon --name=kohadev-koha-indexer --errlog=/var/log/koha/kohadev/indexer-error.log --stdout=/var/log/koha/kohadev/indexer.log --output=/var/log/koha/kohadev/indexer-output.log --verbose=1 --respawn --delay=30 --user=kohadev-koha.kohadev-koha -- /usr/share/koha/bin/migration_tools/rebuild_zebra.pl -daemon -x -sleep 5
kohadev+  3020  0.8 11.0 341964 113288 ?       S    11:52   0:01 /usr/bin/perl /usr/share/koha/bin/migration_tools/rebuild_zebra.pl -daemon -x -sleep 5
Comment 5 Tomás Cohen Arazi (tcohen) 2015-10-13 14:38:07 UTC
(In reply to Jonathan Druart from comment #4)
> The completion works but:
> 
> root@kohadevbox:~# koha-indexer --start kohadev 
> [ ok ] Starting Koha indexing daemon for kohadev:.
> root@kohadevbox:~# koha-indexer --stop kohadev 
> [FAIL] Error: Indexer not running for kohadev: failed!
> 
> root@kohadevbox:~# ps aux | grep zebra
> kohadev+   509  0.0  0.0  18596   188 ?        S    11:45   0:00 daemon
> --name=kohadev-koha-zebra --pidfiles=/var/run/koha/kohadev/
> --errlog=/var/log/koha/kohadev/zebra-error.log
> --stdout=/var/log/koha/kohadev/zebra.log
> --output=/var/log/koha/kohadev/zebra-output.log --verbose=1 --respawn
> --delay=30 --user=kohadev-koha.kohadev-koha -- zebrasrv -v none,fatal,warn
> -f /etc/koha/sites/kohadev/koha-conf.xml
> kohadev+   511  0.0  0.8 121780  9148 ?        S    11:45   0:00 zebrasrv -v
> none,fatal,warn -f /etc/koha/sites/kohadev/koha-conf.xml
> kohadev+  3017  0.0  0.0  18596   188 ?        S    11:52   0:00 daemon
> --name=kohadev-koha-indexer --errlog=/var/log/koha/kohadev/indexer-error.log
> --stdout=/var/log/koha/kohadev/indexer.log
> --output=/var/log/koha/kohadev/indexer-output.log --verbose=1 --respawn
> --delay=30 --user=kohadev-koha.kohadev-koha --
> /usr/share/koha/bin/migration_tools/rebuild_zebra.pl -daemon -x -sleep 5
> kohadev+  3020  0.8 11.0 341964 113288 ?       S    11:52   0:01
> /usr/bin/perl /usr/share/koha/bin/migration_tools/rebuild_zebra.pl -daemon
> -x -sleep 5

Please fill a bug for that...
Comment 6 Tomás Cohen Arazi (tcohen) 2015-10-13 15:16:09 UTC
Patch pushed to master.