Discussion:
[Thinkfinger-devel] [PATCH] Add BASH completion for tf-tool
Luca Capello
2007-05-18 13:56:25 UTC
Permalink
Hello!

The attached patch (contributed by Rafael Laboissiere) adds BASH
completion for tf-tool.

Since not everyone uses BASH, I prepared a new configure option
(--enable-bash) to install or not the BASH completion. The file is
installed as tf-tool_completion, as I don't know how to have it
installed simply as tf-tool. By default, BASH completion is installed
into $sysconfdir/bash_completion.d thus you need to pass
--sysconfdir=$DIR to ./configure, too.

FYI, the BASH completion will be by default included in the Debian
package (of which Joshua and I are fixing the last errors).

Thx, bye,
Gismo / Luca
Stephan Berberig
2007-06-05 19:07:58 UTC
Permalink
Hi Luca,

tested under Ubuntu Edgy and works fine.

Thanks,
Stephan
Post by Luca Capello
Hello!
The attached patch (contributed by Rafael Laboissiere) adds BASH
completion for tf-tool.
Since not everyone uses BASH, I prepared a new configure option
(--enable-bash) to install or not the BASH completion. The file is
installed as tf-tool_completion, as I don't know how to have it
installed simply as tf-tool. By default, BASH completion is installed
into $sysconfdir/bash_completion.d thus you need to pass
--sysconfdir=$DIR to ./configure, too.
FYI, the BASH completion will be by default included in the Debian
package (of which Joshua and I are fixing the last errors).
Thx, bye,
Gismo / Luca
------------------------------------------------------------------------
Index: tf-tool/Makefile.am
===================================================================
--- tf-tool/Makefile.am (revision 108)
+++ tf-tool/Makefile.am (working copy)
@@ -5,3 +5,8 @@
tf_tool_SOURCES = tf-tool.c
tf_tool_LDADD = $(top_builddir)/libthinkfinger/libthinkfinger.la
tf_tool_CFLAGS = $(CFLAGS)
+
+if HAVE_BASH
+completiondir = $(sysconfdir)/bash_completion.d
+completion_SCRIPTS = tf-tool_completion
+endif
Index: tf-tool/tf-tool_completion
===================================================================
--- tf-tool/tf-tool_completion (revision 0)
+++ tf-tool/tf-tool_completion (revision 0)
@@ -0,0 +1,37 @@
+### -*- mode: shell-script -*-
+
+### Programmed completion for bash to use tf-tool
+### Copyright (C) 2007 Rafael Laboissiere <rafael AT debian org>
+
+### This file is licensed under the GNU General Public License, version 2
+### or later. No warranties.
+
+have tf-tool &&
+_tf_tool() {
+ local cur prev xor_opts opts
+
+ xor_opts='--acquire --verify --add-user --verify-user'
+ opts="$xor_opts --verbose"
+
+ cur=${COMP_WORDS[COMP_CWORD]}
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ ## exclude mutually exclusive options
+ && opts=${opts/$xor_opts}
+ ## --verbose can be given along the other options
+ [[ ${COMP_WORDS[i]} == --verbose ]] && opts=${opts/--verbose}
+ done
+
+ case "$prev" in
+ COMPREPLY=( $( compgen -u -- $cur ) )
+ return 0
+ ;;
+ esac
+
+ COMPREPLY=( $( compgen -W "$opts" -- $cur ) )
+
+} &&
+complete -F _tf_tool tf-tool
Index: configure.in
===================================================================
--- configure.in (revision 108)
+++ configure.in (working copy)
@@ -73,6 +73,11 @@
fi
fi
+# AC_ARG_ENABLE_BASH
+AC_MSG_CHECKING([whether to install the BASH completion for tf-tool])
+AC_ARG_ENABLE(bash, AC_HELP_STRING([--enable-bash],[install BASH completion for tf-tool in $sysconfdir/bash_completion.d]),enable_bash=$enableval,enable_bash=no)
+AC_MSG_RESULT([$enable_bash])
+
# AC_ARG_ENABLE SECUREDIR
@@ -176,6 +181,7 @@
# AM_CONDITIONAL
AM_CONDITIONAL(BUILD_PAM, test "x$enable_pam" = "xyes")
AM_CONDITIONAL(HAVE_OLD_PAM, test "x$HAVE_OLD_PAM" = "xyes")
+AM_CONDITIONAL(HAVE_BASH, test "x$enable_bash" = "xyes")
# AC_CONFIG_FILES
AC_CONFIG_FILES([Makefile
@@ -220,5 +226,12 @@
"
fi
+if test "x$enable_bash" = "xyes" ; then
+echo " BASH completion: $enable_bash
+
+ + sysconfdir: `eval echo ${sysconfdir}`
+"
+fi
+
# AC_OUTPUT
AC_OUTPUT
------------------------------------------------------------------------
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
------------------------------------------------------------------------
_______________________________________________
Thinkfinger-devel mailing list
https://lists.sourceforge.net/lists/listinfo/thinkfinger-devel
Timo Hoenig
2007-06-11 10:43:41 UTC
Permalink
Hi Luca,

Sorry for the lag.
Post by Luca Capello
The attached patch (contributed by Rafael Laboissiere) adds BASH
completion for tf-tool.
May I ask for Rafael's mail address? Just for completeness sake.

Thanks,

Timo
Luca Capello
2007-06-11 12:14:40 UTC
Permalink
Hi Timo!
Post by Timo Hoenig
Post by Luca Capello
The attached patch (contributed by Rafael Laboissiere) adds BASH
completion for tf-tool.
May I ask for Rafael's mail address? Just for completeness sake.
Sure, it was "hidden" in the patch: rafael AT debian org.

Thx, bye,
Gismo / Luca
Timo Hoenig
2007-11-15 11:00:36 UTC
Permalink
Hi Luca!
Post by Luca Capello
Hi Timo!
Post by Timo Hoenig
Post by Luca Capello
The attached patch (contributed by Rafael Laboissiere) adds BASH
completion for tf-tool.
May I ask for Rafael's mail address? Just for completeness sake.
Sure, it was "hidden" in the patch: rafael AT debian org.
Committed with small changes (dropped --verify-user and --add-user).

Thanks,

Timo

Loading...