[Bash-completion-commits] [bash-completion] 01/01: export, _variables: Do TZ= completion (Redhat: #994646).

Ville Skyttä scop-guest at alioth.debian.org
Thu Aug 8 09:51:21 UTC 2013


This is an automated email from the git hooks/post-receive script.

scop-guest pushed a commit to branch master
in repository bash-completion.

commit 3f144beb721525821136f76f53a3147b4688d331
Author: Ville Skyttä <ville.skytta at iki.fi>
Date:   Thu Aug 8 12:49:11 2013 +0300

    export, _variables: Do TZ= completion (Redhat: #994646).
    
    Could do this for env, declare, and typeset as well, especially
    when/if we have more known env vars implemented in _variables.
---
 bash_completion    |   18 ++++++++++++++++++
 completions/export |    8 +++++++-
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/bash_completion b/bash_completion
index e997848..44af0d1 100644
--- a/bash_completion
+++ b/bash_completion
@@ -627,6 +627,24 @@ _variables()
         COMPREPLY+=( $( compgen -P ${BASH_REMATCH[1]} -S "$suffix" -v -- \
             "${BASH_REMATCH[2]}" ) )
         return 0
+    else
+        case $prev in
+            TZ)
+                cur=/usr/share/zoneinfo/$cur
+                _filedir
+                for i in ${!COMPREPLY[@]}; do
+                    if [[ ${COMPREPLY[i]} == *.tab ]]; then
+                        unset COMPREPLY[i]
+                        continue
+                    elif [[ -d ${COMPREPLY[i]} ]]; then
+                        COMPREPLY[i]+=/
+                        compopt -o nospace
+                    fi
+                    COMPREPLY[i]=${COMPREPLY[i]#/usr/share/zoneinfo/}
+                done
+                return 0
+                ;;
+        esac
     fi
     return 1
 }
diff --git a/completions/export b/completions/export
index 42273a9..6c4e340 100644
--- a/completions/export
+++ b/completions/export
@@ -24,7 +24,13 @@ _export()
         break
     done
 
-    [[ $cur == *=\$* ]] && { cur=${cur#*=}; _variables; } && return
+    if [[ $cur == *=* ]]; then
+        local ocur=$cur oprev=$prev
+        prev=${cur%%=*}
+        cur=${cur#*=}
+        _variables && return
+        cur=$ocur prev=$oprev
+    fi
 
     case $cur in
         *=)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bash-completion/bash-completion.git



More information about the Bash-completion-commits mailing list