Bug 14727 - koha-indexer tab-completion in bash
Summary: koha-indexer tab-completion in bash
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Command-line Utilities (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Tomás Cohen Arazi (tcohen)
QA Contact: Testopia
URL:
Keywords:
Depends on: 14714
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-25 15:16 UTC by Tomás Cohen Arazi (tcohen)
Modified: 2016-06-21 21:40 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 14727: koha-indexer tab completion in bash (3.13 KB, patch)
2015-08-25 15:22 UTC, Tomás Cohen Arazi (tcohen)
Details | Diff | Splinter Review
Bug 14727: koha-indexer tab completion in bash (3.25 KB, patch)
2015-10-10 00:13 UTC, Jesse Weaver
Details | Diff | Splinter Review
Bug 14727: koha-indexer tab completion in bash (3.33 KB, patch)
2015-10-13 11:54 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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.