kiss: use equ/ok to replace simple cases

This commit is contained in:
Dylan Araps 2021-07-19 08:06:32 +03:00
parent 0d7d24c40b
commit fcc9d0f536
No known key found for this signature in database
GPG Key ID: 13295DAC2CF13B5C

14
kiss
View File

@ -195,10 +195,7 @@ sh256() {
[ -d "$f" ] || [ ! -e "$f" ] || set -- "$@" "$f" [ -d "$f" ] || [ ! -e "$f" ] || set -- "$@" "$f"
done done
# Nothing to do. ! equ "$#" 0 || return 0
case $# in 0)
return
esac
# Set the arguments based on found sha256 utility. # Set the arguments based on found sha256 utility.
case ${cmd_sha##*/} in case ${cmd_sha##*/} in
@ -482,9 +479,7 @@ pkg_extract() {
pkg_source_resolve "$1" "$src" "$dest" >/dev/null pkg_source_resolve "$1" "$src" "$dest" >/dev/null
# Create the source's directories if not null. # Create the source's directories if not null.
case $_res in *?*) ! ok "$_res" || mkcd "$mak_dir/$1/$dest"
mkcd "$mak_dir/$1/$dest"
esac
case $_res in case $_res in
git+*) git+*)
@ -754,7 +749,7 @@ pkg_manifest_replace() {
tmp_file "$1" "manifest-replace-${2##*/}" tmp_file "$1" "manifest-replace-${2##*/}"
while read -r line; do while read -r line; do
case $line in "$2") line=$3; esac ! equ "$line" "$2" || line=$3
printf '%s\n' "$line" printf '%s\n' "$line"
done < "$sys_db/$1/manifest" | sort -r > "$_tmp_file" done < "$sys_db/$1/manifest" | sort -r > "$_tmp_file"
@ -1057,9 +1052,8 @@ pkg_conflicts() {
for manifest do for manifest do
shift shift
case $manifest in "$sys_db/$_pkg/manifest") ! equ "$manifest" "$sys_db/$_pkg/manifest" ||
continue continue
esac
set -- "$@" "$manifest" set -- "$@" "$manifest"
done done