1
0
mirror of https://github.com/UzixLS/picocom.git synced 2025-07-19 07:21:18 +03:00

Handle arg values given with =

This commit is contained in:
Nick Patavalis
2018-02-09 11:28:01 +02:00
parent 907bce55d0
commit 4c3657a180

View File

@ -298,21 +298,19 @@ _picocom()
echo "------------" > $DEBUG echo "------------" > $DEBUG
echo COMP_LINE "$COMP_LINE" > $DEBUG echo COMP_LINE "$COMP_LINE" > $DEBUG
echo COMP_POINT $COMP_POINT > $DEBUG echo COMP_POINT $COMP_POINT > $DEBUG
echo COMP_CWORD $COMP_CWORD > $DEBUG
local wrd local wrd
for wrd in "${COMP_WORDS[@]}"; do for wrd in "${words[@]}"; do
echo -n "$wrd | " > $DEBUG echo -n "$wrd | " > $DEBUG
done done
echo > $DEBUG echo > $DEBUG
echo "$prev | $cur | " > $DEBUG echo "$prev | $cur | " > $DEBUG
# Try to handle option values given with "=" # Handle option values given with "=" or "=="
if [[ $cur == "=" ]]; then if [[ $cur =~ "="+ ]]; then
_picocom_is_opt "$prev" && cur= _picocom_is_opt "$prev" && cur=
fi fi
if [[ $prev == "=" && $COMP_CWORD -gt 1 ]]; then if [[ $prev =~ "="+ ]]; then
prev1="${COMP_WORDS[COMP_CWORD-2]}" _picocom_is_opt "${words[-3]}" && prev="${words[-3]}"
_picocom_is_opt "$prev1" && prev="$prev1"
fi fi
case "$prev" in case "$prev" in
@ -380,7 +378,7 @@ _picocom()
;; ;;
esac esac
if [[ ${cur} = -* ]] ; then if [[ ${cur} == -* ]] ; then
COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") ) COMPREPLY=( $(compgen -W "${opts[*]}" -- "$cur") )
# This only works for bash 4.4 and newer # This only works for bash 4.4 and newer
compopt -o nosort > /dev/null 2>&1 compopt -o nosort > /dev/null 2>&1