[arch-commits] Commit in fossil/trunk (5 files)

Anatol Pomozov anatolik at archlinux.org
Fri Feb 6 17:19:19 UTC 2015


    Date: Friday, February 6, 2015 @ 18:19:19
  Author: anatolik
Revision: 127195

Use zsh/bash completion files from AUR fossil-tip project

Added:
  fossil/trunk/fossil-autocomplete.bash
  fossil/trunk/fossil-autocomplete.zsh
Modified:
  fossil/trunk/PKGBUILD
Deleted:
  fossil/trunk/bash.completion
  fossil/trunk/zsh.completion

--------------------------+
 PKGBUILD                 |   16 ++++++++++------
 bash.completion          |   33 ---------------------------------
 fossil-autocomplete.bash |   33 +++++++++++++++++++++++++++++++++
 fossil-autocomplete.zsh  |   30 ++++++++++++++++++++++++++++++
 zsh.completion           |   20 --------------------
 5 files changed, 73 insertions(+), 59 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2015-02-06 15:46:59 UTC (rev 127194)
+++ PKGBUILD	2015-02-06 17:19:19 UTC (rev 127195)
@@ -18,17 +18,21 @@
   fossil.socket
   fossil.service
   fossil-xinetd
-  bash.completion
-  zsh.completion
+  fossil-autocomplete.bash
+  fossil-autocomplete.zsh
   http://www.fossil-scm.org/download/fossil-src-$_date_pkgver.tar.gz
 )
 sha256sums=('f885e17998dc1eece1688a75e516663462fe72a7f4f132def4132055777c7ff8'
             'c4973079facf209d3757db81df08f8d0843ede242f2a0c12281720da65e3b166'
             '2f9a141fadfb7cb5225f0d65a308949bbc592bff9d567b5c472edb413c81f5aa'
-            'e22e19dba1a4be6a62af0b77ff0267c2a0f19edf2f6a9133ee64246fae5d87da'
-            '2099785dd126c59e4abf2d13cc40aee8dcc562f7737c9897f07845888b1d40ae'
+            '3e80a8a8f71ff450919df16864d987e669acf31670e484721b977a3bb2960a89'
+            'aeca50e6382da7c50d696cf971947a09cb14d572ee9f191b4113fd84286b5edd'
             '37969e5a09c1611199921e3518a4ed736fd637a02f2d5810cd45897a4ceb92dc')
 
+prepare() {
+  cp fossil-autocomplete.{bash,zsh} fossil-src-$_date_pkgver/tools
+}
+
 build() {
   cd fossil-src-$_date_pkgver
   ./configure --prefix=/usr
@@ -41,10 +45,10 @@
   install -Dm644 fossil-xinetd "$pkgdir"/etc/xinetd.d/fossil
   install -Dm644 fossil.socket "$pkgdir"/usr/lib/systemd/system/fossil.socket
   install -Dm644 fossil.service "$pkgdir"/usr/lib/systemd/system/fossil at .service
-  install -Dm644 bash.completion "$pkgdir"/usr/share/bash-completion/completions/fossil
-  install -Dm644 zsh.completion $pkgdir/usr/share/zsh/site-functions/_fossil
 
   cd fossil-src-$_date_pkgver
   install -Dm755 fossil "$pkgdir"/usr/bin/fossil
   install -Dm644 COPYRIGHT-BSD2.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
+  install -Dm644 tools/fossil-autocomplete.bash "$pkgdir"/usr/share/bash-completion/completions/fossil
+  install -Dm644 tools/fossil-autocomplete.zsh $pkgdir/usr/share/zsh/site-functions/_fossil
 }

Deleted: bash.completion
===================================================================
--- bash.completion	2015-02-06 15:46:59 UTC (rev 127194)
+++ bash.completion	2015-02-06 17:19:19 UTC (rev 127195)
@@ -1,33 +0,0 @@
-_fossil()
-{
-local cur prev opts
-
-#Var used by BASH
-COMPREPLY=()
-#word we are trying to complete
-cur="${COMP_WORDS[COMP_CWORD]}"
-#word before the one we're trying to complete
-prev="${COMP_WORDS[COMP_CWORD-1]}"
-#list of word that fossil know
-opts="add addremove all annotate bisect branch cat changes checkout "
-opts="$opts ci clean clone close co commit delete diff export extras "
-opts="$opts finfo gdiff help import info init ls merge mv new open "
-opts="$opts pull push rebuild remote-url revert rm settings sqlite3 "
-opts="$opts stash status sync tag timeline ui undo unset update version"
-
-case "${prev}" in
-add) opts="--dotfiles --ignore" ;;
-addremove) opts="--dotfiles --ignore --test" ;;
-all) opts="list ls pull push rebuild sync" ;;
-annotate) opts="--limit --log --filevers" ;;
-bisect) opts="bad good next options reset vlist" ;;
-branch) opts="list ls -R --repository" ;;
-merge) opts="--nochange -n --force -f --detail"
-esac
-
-compopt -o filenames
-COMPREPLY=($(compgen -fW "${opts}" -- "${cur}") \
-$(compgen -d -- "$cur"))
-}
-
-complete -F _fossil fossil

Added: fossil-autocomplete.bash
===================================================================
--- fossil-autocomplete.bash	                        (rev 0)
+++ fossil-autocomplete.bash	2015-02-06 17:19:19 UTC (rev 127195)
@@ -0,0 +1,33 @@
+# Command name bash completion for Fossil.
+# Original: Mailing-list contribution by Stuart Rackham.
+# Maintainer: Daniel YC Lin <dlin.tw at gmail.com>
+# I'm not bash expert, please feed back to me, if you could improve this.
+# TODO: fossil branch list --options
+
+function _fossil() {
+    local cur commands
+    cur=${COMP_WORDS[COMP_CWORD]}
+    prev="${COMP_WORDS[COMP_CWORD-1]}"
+    commands=$(fossil help --all)
+    if [ $COMP_CWORD -eq 1 ] || [ ${COMP_WORDS[1]} = help ]; then
+            # Command name completion for 1st argument or 2nd if help command.
+        COMPREPLY=( $(compgen -W "$commands" $cur) )
+    else
+        case "${prev}" in
+            add) opts="--case-sensitive --dotfiles --force --ignore --clean" ;;
+            addremove) opts="--case-sensitive --dotfiles --ignore --clean --dry-run" ;;
+            all) opts="changes clean dbstat extras ignore info list pull push rebuild sync setting set unset" ;;
+            annotate) opts="--filevers --log --limit --ignore-all-space --ignore-trailing-space" ;;
+            bisect) opts="bad good log chart next options reset status undo" ;;
+            branch) opts="new list" ;;
+            merge) opts="--baseline --binary --case-sensitive --force --force-missing --integrate --dry-run --verbose" ;;
+        esac
+        compopt -o filenames
+        COMPREPLY=($(compgen -fW "${opts}" -- "${cur}") \
+        $(compgen -d -- "$cur"))
+        # File name completion for other arguments.
+        #COMPREPLY=( $(compgen -f $cur) )
+    fi
+}
+complete -o default -F _fossil fossil f
+# vim: et sw=4 ts=4

Added: fossil-autocomplete.zsh
===================================================================
--- fossil-autocomplete.zsh	                        (rev 0)
+++ fossil-autocomplete.zsh	2015-02-06 17:19:19 UTC (rev 127195)
@@ -0,0 +1,30 @@
+#compdef fossil
+
+# zsh completion wrapper for zsh by Daniel YC Lin <dlin.tw at gmail.com>
+# I'm not zsh expert, please help me to fix this. 2015/02/06
+# TODO: fossil add -option<tab>
+#
+# Usage example:
+# 	cp fossil-autocomplete.zsh ~/zshfunc/_fossil
+#	fpath=(~/zshfunc $fpath)
+#	autoload -U ~/zshfunc/*(:t)
+# Package example:
+#       install -Dm644 fossil-autocomplete.zsh /share/zsh/site-functions/_fossil
+
+local curcontext="$curcontext" state line expl ret=1
+typeset -A opt_args
+
+_arguments -C \
+    '(-)--help[print help information]' \
+    '1: :->cmds' \
+    '*:files:_files' && ret=0
+
+_fossil_cmds=($(LC_ALL=C fossil help -a))
+_fossil_commands() {
+  compadd "$@" -k _fossil_cmds
+}
+case $state in
+  cmds)
+      _wanted commands expl 'fossil help' _fossil_commands && ret=0
+  ;;
+esac

Deleted: zsh.completion
===================================================================
--- zsh.completion	2015-02-06 15:46:59 UTC (rev 127194)
+++ zsh.completion	2015-02-06 17:19:19 UTC (rev 127195)
@@ -1,20 +0,0 @@
-#compdef fossil
-
-local curcontext="$curcontext" state line expl ret=1
-typeset -A opt_args
-
-_arguments -C \
-    '(-)--help[print help information]' \
-    '--args -- FILE [read args and files from file]' \
-    '1: :->cmds' \
-    '*:: :->args' && ret=0
-
-_fossil_cmds=($(LC_ALL=C fossil help -a))
-_fossil_commands() {
-  compadd "$@" -k _fossil_cmds
-}
-case $state in
-  cmds)
-      _wanted commands expl 'fossil help' _fossil_commands && ret=0
-  ;;
-esac



More information about the arch-commits mailing list