summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Ballier <aballier@gentoo.org>2010-06-11 19:18:43 +0000
committerAlexis Ballier <aballier@gentoo.org>2010-06-11 19:18:43 +0000
commit6d4e3f1f0274e35f8c97dfdabd9cd1ba8feb202d (patch)
tree37f4f40f3623d7a06d06d2e48c037fe9918b7bc3 /dev-tex
parentRemoving myself as maintainer (diff)
downloadgentoo-2-6d4e3f1f0274e35f8c97dfdabd9cd1ba8feb202d.tar.gz
gentoo-2-6d4e3f1f0274e35f8c97dfdabd9cd1ba8feb202d.tar.bz2
gentoo-2-6d4e3f1f0274e35f8c97dfdabd9cd1ba8feb202d.zip
add bash-completion support by Christoph Junghans <kleiner_otti@gmx.de>, bug #323561
(Portage version: 2.2_rc67/cvs/Linux x86_64)
Diffstat (limited to 'dev-tex')
-rw-r--r--dev-tex/latexmk/ChangeLog7
-rw-r--r--dev-tex/latexmk/files/completion.bash45
-rw-r--r--dev-tex/latexmk/latexmk-416a.ebuild5
3 files changed, 55 insertions, 2 deletions
diff --git a/dev-tex/latexmk/ChangeLog b/dev-tex/latexmk/ChangeLog
index 534f7dfea489..6a646af3a58f 100644
--- a/dev-tex/latexmk/ChangeLog
+++ b/dev-tex/latexmk/ChangeLog
@@ -1,6 +1,11 @@
# ChangeLog for dev-tex/latexmk
# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-tex/latexmk/ChangeLog,v 1.16 2010/06/11 11:26:30 aballier Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-tex/latexmk/ChangeLog,v 1.17 2010/06/11 19:18:43 aballier Exp $
+
+ 11 Jun 2010; Alexis Ballier <aballier@gentoo.org> latexmk-416a.ebuild,
+ +files/completion.bash:
+ add bash-completion support by Christoph Junghans <kleiner_otti@gmx.de>,
+ bug #323561
*latexmk-416a (11 Jun 2010)
diff --git a/dev-tex/latexmk/files/completion.bash b/dev-tex/latexmk/files/completion.bash
new file mode 100644
index 000000000000..12575774c242
--- /dev/null
+++ b/dev-tex/latexmk/files/completion.bash
@@ -0,0 +1,45 @@
+#! /bin/bash
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# bash_completion for latexmk
+#
+#
+# Author: Christoph Junghans
+# junghans@mpip-mainz.mpg.de
+#
+# Revision history:
+# 0.1 26-05-10 --- initial version
+#
+# HOWTO:
+# source this file to enable it
+
+_latexmk()
+{
+ #we have perl due to the fact that latexmk is written in perl
+ local cur output opts prev
+ cur=${COMP_WORDS[COMP_CWORD]}
+ prev=${COMP_WORDS[COMP_CWORD-1]}
+
+ output=$( $1 -help 2> /dev/null)
+ #options with args
+ aopts=" $( echo " $output" | sed -n 's/^[[:space:]]\+\(-[^[:space:]]\+\)[[:space:]]\+<[^>]\+>.*$/\1/p' | sort -u | tr '\n' ' ')"
+ #if previous option in in $aopts
+ if [[ -n "$prev" ]] && [[ -z "${aopts//* $prev *}" ]]; then
+ #argument of $pres
+ opts=$(echo "$output" | sed -n "s/^[[:space:]]\+$prev[[:space:]]\+\(<[^>]\+>\).*\$/\1/p")
+ COMPREPLY=( $( compgen -W '$opts' -- $cur ) )
+ elif [[ "$cur" == -* ]]; then
+ #all options
+ opts=$( echo "$output" | sed -n 's/^[[:space:]]\+\(-[^[:space:]]\+\).*$/\1/p'| sort -u )
+ COMPREPLY=( $( compgen -W '$opts' -- $cur ) )
+ else
+ #filenames *.tex and dirs, rest is done by '-o filenames' below
+ COMPREPLY=( $( eval compgen -f -X "!*.tex" -- ${cur} ) $( compgen -d -- $cur ) )
+ fi
+}
+
+complete -F _latexmk -o filenames latexmk
diff --git a/dev-tex/latexmk/latexmk-416a.ebuild b/dev-tex/latexmk/latexmk-416a.ebuild
index db9cf493c2e6..ca3d27c7f7b5 100644
--- a/dev-tex/latexmk/latexmk-416a.ebuild
+++ b/dev-tex/latexmk/latexmk-416a.ebuild
@@ -1,6 +1,8 @@
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/dev-tex/latexmk/latexmk-416a.ebuild,v 1.1 2010/06/11 11:26:30 aballier Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-tex/latexmk/latexmk-416a.ebuild,v 1.2 2010/06/11 19:18:43 aballier Exp $
+
+inherit bash-completion
DESCRIPTION="Perl script for automatically building LaTeX documents."
HOMEPAGE="http://www.phys.psu.edu/~collins/software/latexmk/"
@@ -23,4 +25,5 @@ src_install() {
doman latexmk.1
insinto /usr/share/doc/${PF}
doins -r example_rcfiles extra-scripts
+ dobashcompletion "${FILESDIR}"/completion.bash ${PN}
}