fix: Fix line break in list result
This commit is contained in:
+9
-9
@@ -39,7 +39,7 @@ _decrement_selected() {
|
|||||||
if [ "${selected}" -lt 0 ]; then
|
if [ "${selected}" -lt 0 ]; then
|
||||||
selected=$(($2 - 1));
|
selected=$(($2 - 1));
|
||||||
fi
|
fi
|
||||||
echo $selected
|
echo -n $selected
|
||||||
}
|
}
|
||||||
|
|
||||||
# increment counter $1, considering out of range for $2
|
# increment counter $1, considering out of range for $2
|
||||||
@@ -49,7 +49,7 @@ _increment_selected() {
|
|||||||
if [ "${selected}" -ge "${opts_count}" ]; then
|
if [ "${selected}" -ge "${opts_count}" ]; then
|
||||||
selected=0;
|
selected=0;
|
||||||
fi
|
fi
|
||||||
echo $selected
|
echo -n $selected
|
||||||
}
|
}
|
||||||
|
|
||||||
# checks if $1 contains element $2
|
# checks if $1 contains element $2
|
||||||
@@ -75,7 +75,7 @@ _contains() {
|
|||||||
input() {
|
input() {
|
||||||
_prompt_text "$1"; echo -en "\e[36m\c" >&2
|
_prompt_text "$1"; echo -en "\e[36m\c" >&2
|
||||||
read -r text
|
read -r text
|
||||||
echo "${text}"
|
echo -n "${text}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# @description Show confirm dialog for yes/no
|
# @description Show confirm dialog for yes/no
|
||||||
@@ -99,8 +99,8 @@ confirm() {
|
|||||||
echo -en "\e[0m" >&2
|
echo -en "\e[0m" >&2
|
||||||
|
|
||||||
case $result in
|
case $result in
|
||||||
y) echo 1; ;;
|
y) echo -n 1; ;;
|
||||||
N) echo 0 ;;
|
N) echo -n 0 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
echo "" >&2
|
echo "" >&2
|
||||||
@@ -154,13 +154,13 @@ list() {
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
echo -en "\n"
|
echo -en "\n" >&2
|
||||||
|
|
||||||
# cursor position back to normal
|
# cursor position back to normal
|
||||||
_cursor_to "${lastrow}"
|
_cursor_to "${lastrow}"
|
||||||
_cursor_blink_on
|
_cursor_blink_on
|
||||||
|
|
||||||
echo "${selected}"
|
echo -n "${selected}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# @description Render a text based list of options, where multiple can be selected by the
|
# @description Render a text based list of options, where multiple can be selected by the
|
||||||
@@ -228,7 +228,7 @@ checkbox() {
|
|||||||
_cursor_to "${lastrow}"
|
_cursor_to "${lastrow}"
|
||||||
_cursor_blink_on
|
_cursor_blink_on
|
||||||
|
|
||||||
IFS=" " echo "${checked[@]}"
|
IFS=" " echo -n "${checked[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# @description Show password prompt displaying stars for each password character letter typed
|
# @description Show password prompt displaying stars for each password character letter typed
|
||||||
@@ -263,7 +263,7 @@ password() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo -en "\e[0m" >&2
|
echo -en "\e[0m" >&2
|
||||||
echo "${password}"
|
echo -n "${password}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# @description Open default editor ($EDITOR) if none is set falls back to vi
|
# @description Open default editor ($EDITOR) if none is set falls back to vi
|
||||||
|
|||||||
Reference in New Issue
Block a user