[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone: 1772cce37d847988cdd8ec0df2
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone: 1772cce37d847988cdd8ec0df280ba2659945004 |
Date: |
Sat, 5 Feb 2011 01:31:08 GMT |
revision: 1772cce37d847988cdd8ec0df280ba2659945004
date: 2011-02-05T01:30:48
author: Richard Levitte <address@hidden>
branch: net.venge.monotone
changelog:
* contrib/monotone.bash_completion2: When using single [] for testing,
check for equality with = rather than ==.
Tell _get_comp_words_by_ref not to break up words on =; the reason
for this is that some versions of bash_completion leave the = as a
single word, which is confusing. Instead, let's process --opt=val
ourselves.
Use the first word as command rather than just 'mtn'; the reason for
this is that someone might complete a different mtn than the default
one.
manifest:
format_version "1"
new_manifest [89ddde29e2928a86a8edd505a2dc9b6a73112aef]
old_revision [534f5807048537b37bb40b2db3d7e1fc01581cbb]
patch "contrib/monotone.bash_completion2"
from [cb362c2f5061d5846b81d4837c0a7342959b303d]
to [18d37b298ebc9dd1916e04cad7aaffd1d7a300d8]
============================================================
--- contrib/monotone.bash_completion2 cb362c2f5061d5846b81d4837c0a7342959b303d
+++ contrib/monotone.bash_completion2 18d37b298ebc9dd1916e04cad7aaffd1d7a300d8
@@ -451,7 +451,7 @@ _monotone_complete() {
# Call monotone to complete IDs
_monotone_complete() {
if (( "${#cur}" >=2 )) ; then
- COMPREPLY=( "address@hidden" $(mtn $mono_db complete $1 $cur 2> /dev/null) )
+ COMPREPLY=( "address@hidden" $(${mtn} $mono_db complete $1 $cur 2> /dev/null) )
fi
}
@@ -478,21 +478,21 @@ _monotone_keys() {
# Call monotone to complete key ids (private or public)
_monotone_keys() {
local range
- if [ "$1" == "privkey" ]; then
+ if [ "$1" = "privkey" ]; then
range='/\[private/,$'
else
range='1,/\[private/'
fi
- COMPREPLY=( "address@hidden" $(compgen -W "$(mtn $mono_db list keys 2> /dev/null |\
+ COMPREPLY=( "address@hidden" $(compgen -W "$(${mtn} $mono_db list keys 2> /dev/null |\
sed -n ${range}'{/^[0-9a-f]/s/[0-9a-f]* //p}')" -- ${cur#*=} ) )
}
_monotone_branches() {
- COMPREPLY=( "address@hidden" $(compgen -W "$(mtn $mono_db list branches 2> /dev/null)" -- ${cur#*=} ) )
+ COMPREPLY=( "address@hidden" $(compgen -W "$(${mtn} $mono_db list branches 2> /dev/null)" -- ${cur#*=} ) )
}
_monotone_tags() {
- COMPREPLY=( "address@hidden" $(compgen -W "$(mtn $mono_db list tags 2> /dev/null | awk '{print $1}')" -- ${cur#*=} ) )
+ COMPREPLY=( "address@hidden" $(compgen -W "$(${mtn} $mono_db list tags 2> /dev/null | awk '{print $1}')" -- ${cur#*=} ) )
}
_monotone_public_key() {
@@ -546,9 +546,20 @@ _monotone_command_words() {
w=mtn
fi
- if [[ "$w" == --*=* || "$w" == -* ]]; then
- :
- elif [[ "$pw" != -* \
+ # if the current word is '--opt=val', split it up into '--opt' and 'val'
+ if [[ "$w" == --?*=* ]]; then
+ if [[ "$pw" == -* \
+ && " ${_monotone_options_noarg[*]} " != *\ $pw\ * ]]; then
+ # Current word is an argument to an earlier option,
+ # so we skip past it
+ continue
+ fi
+ pw="${w%%?(\\)=*}"
+ w="${w#*=}"
+ elif [[ "$w" == -* ]]; then
+ continue
+ fi
+ if [[ "$pw" != -* \
|| " ${_monotone_options_noarg[*]} " == *\ $pw\ * ]]; then
if [[ -z "$cmd_line" \
|| -n "${_monotone_commands[$cmd_line]}" ]]; then
@@ -582,7 +593,7 @@ _monotone() {
}
_monotone() {
- local cur prev words cword mono_db
+ local cur prev words cword mono_db mtn
local cmd_words cmd_cword cmd_cur cmd_prev cmd_line cmd_prev_line
local arg_words arg_cword arg_cur arg_prev
local i cmdi argi
@@ -603,10 +614,11 @@ _monotone() {
COMPREPLY=()
- _get_comp_words_by_ref -n : cur prev words cword
+ _get_comp_words_by_ref -n := cur prev words cword
_split_longopt
_monotone_command_words
+ mtn=${words[0]}
for w in address@hidden ; do
if [[ "$w" == --db=* ]] ; then
mono_db="$w" ; break
@@ -616,7 +628,7 @@ _monotone() {
for i in address@hidden ; do
[ $i -eq 0 ] && continue
x="${words[$i-1]}"
- if [ "$x" == --db -o "$x" == -d ] ; then
+ if [ "$x" = --db -o "$x" = -d ] ; then
mono_db="--db=${words[$i]}" ; break
fi
done
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone: 1772cce37d847988cdd8ec0df280ba2659945004,
code <=