kiss: contains() fixes and bug fix for repository paths containing spaces.

This commit is contained in:
Dylan Araps 2020-09-26 17:03:13 +03:00
parent fc54435595
commit 8dae372609
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

17
kiss
View File

@ -21,7 +21,15 @@ die() {
}
contains() {
case " $1 " in *" $2 "*) return 0; esac; return 1
_sep=${3:- }
case "${_sep}${1}${_sep}" in
*"${_sep}${2}${_sep}"*)
return 0
;;
esac
return 1
}
prompt() {
@ -1198,8 +1206,8 @@ pkg_updates() {
git_root=$(git rev-parse --show-superproject-working-tree)
cd "${git_root:-.}"
contains "$repos" "$PWD" || {
repos="$repos $PWD "
contains "$repos" "$PWD" : || {
repos="$repos:$PWD"
# Display a tick if signing is enabled for this repository.
case $(git config merge.verifySignatures) in
@ -1335,7 +1343,8 @@ args() {
case $action in
a|alternatives|i|install|r|remove)
[ -z "$1" ] || [ -w "$KISS_ROOT/" ] || [ "$uid" = 0 ] || {
as_root HOME="$HOME" \
as_root \
HOME="$HOME" \
XDG_CACHE_HOME="$XDG_CACHE_HOME" \
KISS_CHOICE="$KISS_CHOICE" \
KISS_COLOR="$KISS_COLOR" \