add bash-completion support by Christoph Junghans <kleiner_otti@gmx.de>, bug #323561
authorAlexis Ballier <aballier@gentoo.org>
Fri, 11 Jun 2010 19:18:43 +0000 (19:18 +0000)
committerAlexis Ballier <aballier@gentoo.org>
Fri, 11 Jun 2010 19:18:43 +0000 (19:18 +0000)
Package-Manager: portage-2.2_rc67/cvs/Linux x86_64

dev-tex/latexmk/ChangeLog
dev-tex/latexmk/Manifest
dev-tex/latexmk/files/completion.bash [new file with mode: 0644]
dev-tex/latexmk/latexmk-416a.ebuild

index 534f7dfea4898859e87280d411991c8d1c8176d7..6a646af3a58f114236a8803a873b98a0c706c546 100644 (file)
@@ -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)
 
index 91cf3adc6b7e4182e437b1c639f1726e806d74d6..d5a0334372f8a801d5c5d3107d19489f1f539ef5 100644 (file)
@@ -1,16 +1,17 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
+AUX completion.bash 1489 RMD160 7059476d15f2bdd43547249fc08fba10ccec77fa SHA1 662f860a807db5098f2d2925f188c46b2e414fd0 SHA256 7ea5c3f1ca268a7e95249c1fabbb9ab48fb29609adc1063232f09df931b2dab6
 DIST latexmk-408.zip 265278 RMD160 741ee4fe21fbb1bf31c5f953101a3700befcbad9 SHA1 16b5ddf561d4e0feabffd779159f8557645bac75 SHA256 59d3fa3cc0968fdc2b6be27f999d74b03a024bb0078dbb7ccce86c5d6914118b
 DIST latexmk-416a.zip 281620 RMD160 48cb76871510f2ed68705dd93e7488f47edc0540 SHA1 7505af8a6d7c8aebab0683ceadb674b37ef8d8cc SHA256 06f9e104d1e632997bb555492ef304dc15529b55a2ade3838b2131ef5356acd5
 EBUILD latexmk-408.ebuild 761 RMD160 057ba8c504d81d65d1b69e81b3530e0f26874549 SHA1 5adebcf40cd52dbd5195aed0eae1bba4e758bbde SHA256 f2175e42eb00dd09922e405342ff739e61cbcdb1e628a1ca6ed2db4ed4a5dc7a
-EBUILD latexmk-416a.ebuild 766 RMD160 d03750d461bddc33fa89fe25e854d97943ac7e0d SHA1 ec3caf9d8422fe95d31b9d5e4bc45ff3541ef7fb SHA256 c9d6ed683b25cbd909cbd68d332ab79dcc4c9d118d592bc4b8e089e8a34902f6
-MISC ChangeLog 2235 RMD160 a2daaa3c799dae28bb7e44c79270b0c28038e56d SHA1 9d173eef25bb0a30b62b5d23cdcf657294e79fcf SHA256 6e3058d259191ff92d411f9b0427a62f550bd6fca26f5921768fb58fa7dfd96c
+EBUILD latexmk-416a.ebuild 845 RMD160 de6b2269fed9f791646a3e73727ae45e169cd521 SHA1 3922a68d5899e4b89c6fa0a9741b80b7c46f2a4a SHA256 a201049b5e31a6169409df5741583639342a8c7685f10082d40ab2fdf9ee77b1
+MISC ChangeLog 2424 RMD160 b999e84af1559592d6ed3b596da56569a97a8d63 SHA1 c93ab52c6d0d7d69d68e8e8c75f2d05916dbce1d SHA256 163ced02ff1f1ce73d0164102516572f5bf914c61e6a58bfdad36fff7c1ad19b
 MISC metadata.xml 157 RMD160 e666a9e73ee48e70d6fc6ea78049d38b1fcde7c2 SHA1 43a0c32101f0c6ffd8fa1aa620c8032d194a9e3a SHA256 18238fb417d8677a0495cdaba9b043526174ba63b51494b88b10aa7dd903124c
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.15 (GNU/Linux)
 
-iEYEARECAAYFAkwSHWsACgkQvFcC4BYPU0qCewCgiaaaF70g/sHS0Qk9CscQOnFe
-AKYAnjoKtehpQ2cQcNk765wk+GaP+uGa
-=32k7
+iEYEARECAAYFAkwSjBkACgkQvFcC4BYPU0rBjgCfQudjbycku8Bmja9Pu7njjYly
+O/YAoM3NRaQU5OOD/9uPtSnY1K4Fnzl1
+=+hyR
 -----END PGP SIGNATURE-----
diff --git a/dev-tex/latexmk/files/completion.bash b/dev-tex/latexmk/files/completion.bash
new file mode 100644 (file)
index 0000000..1257577
--- /dev/null
@@ -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
index db9cf493c2e657af5fb73afb40f60b65731bc624..ca3d27c7f7b53ed991f206bf037c78bdeb4f62fa 100644 (file)
@@ -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}
 }