slapt-{get,src}: Fix issue with sed not being able to handle some characters

# LC_ALL=C slapt-get --search "^moo" | sed -ne "/^moo/{s/ .*$//;p}"
 moos-project-viewer-2.8.1-x86_64-1sl [inst=no]: moos-project-viewer - Free Viewer for Microsoft®

 # LC_ALL=C slapt-get --search "^moo" | LC_ALL=C sed -ne "/^moo/{s/ .*$//;p}"
 moos-project-viewer-2.8.1-x86_64-1sl
This commit is contained in:
Igor Murzov 2014-06-05 01:51:16 +04:00
parent 3a65be4a18
commit 70e52c8a1f
2 changed files with 9 additions and 8 deletions

View File

@ -55,13 +55,13 @@ _slapt_get()
# slapt-get will fail to search for "^name-version"
# it can search for names only
local name=${cur%%-*}
COMPREPLY=( $( slapt-get -c $config --search "^$name" 2>/dev/null |\
sed -ne "/^$cur/{s/ .*$//;p}" ) )
COMPREPLY=( $( LC_ALL=C "$1" -c "$config" --search "^$name" 2> \
/dev/null | LC_ALL=C sed -ne "/^$cur/{s/ .*$//;p}" ) )
return
;;
avl) # --install|-i|
COMPREPLY=( $( slapt-get -c $config --available 2>/dev/null | \
sed -ne "/^$cur/{s/ .*$//;p}" ) )
COMPREPLY=( $( LC_ALL=C "$1" -c "$config" --available 2> \
/dev/null | LC_ALL=C sed -ne "/^$cur/{s/ .*$//;p}" ) )
return
;;
ins) # --remove|--filelist

View File

@ -49,11 +49,12 @@ _slapt_src()
if [[ "$cur" == *:* ]]; then
local name=${cur%:*}
local version=${cur##*:}
COMPREPLY=( $( slapt-src --config "$config" --search "^$name" 2> \
/dev/null | sed -ne "/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p}" ) )
COMPREPLY=( $( LC_ALL=C "$1" --config "$config" --search "^$name" 2> \
/dev/null | LC_ALL=C sed -ne \
"/^$cur/{s/^$name:\([^ ]*\) .*$/\1/;p}" ) )
else
COMPREPLY=( $( slapt-src --config "$config" --search "^$cur" 2> \
/dev/null | sed -ne "/^$cur/{s/ .*$//;p}" ) )
COMPREPLY=( $( LC_ALL=C "$1" --config "$config" --search "^$cur" 2> \
/dev/null | LC_ALL=C sed -ne "/^$cur/{s/ .*$//;p}" ) )
fi
} && complete -F _slapt_src slapt-src