Update lib-core.sh

This commit is contained in:
Vince 2021-07-27 21:07:55 +08:00
parent 7f4bf72ce0
commit c790fa2763

View file

@ -158,6 +158,23 @@ anim=(
" ${c_blue}${c_green}${c_red}${c_magenta}" " ${c_blue}${c_green}${c_red}${c_magenta}"
) )
# Check command availability
has_command() {
command -v "$1" &> /dev/null
}
has_flatpak_app() {
flatpak list --columns=application | grep "${1}" &> /dev/null || return 1
}
has_snap_app() {
snap list "${1}" &> /dev/null || return 1
}
is_my_distro() {
[[ "$(cat '/etc/os-release' | awk -F '=' '/ID/{print $2}')" =~ "${1}" ]]
}
############################################################################### ###############################################################################
# CORE UTILITIES # # CORE UTILITIES #
############################################################################### ###############################################################################
@ -286,6 +303,10 @@ signal_error() {
prompt -e "GNOME : ${GNOME_VERSION}" prompt -e "GNOME : ${GNOME_VERSION}"
prompt -e "REPO : ${repo_ver}\n" prompt -e "REPO : ${repo_ver}\n"
if has_command apt; then
prompt -i "HINT: Try install depends to fix this: sudo apt install sassc libglib2.0-dev-bin libxml2-utils\n"
fi
prompt -i "HINT: You can google or report to us the info above\n" prompt -i "HINT: You can google or report to us the info above\n"
prompt -i "https://github.com/vinceliuice/WhiteSur-gtk-theme/issues\n\n" prompt -i "https://github.com/vinceliuice/WhiteSur-gtk-theme/issues\n\n"
@ -351,23 +372,6 @@ helpify() {
printf " ${c_blue}%s ${c_green}%s\n ${c_magenta}%s. ${c_cyan}%s\n\n${c_default}" "${1}" "${2}" "${3}" "${4}" printf " ${c_blue}%s ${c_green}%s\n ${c_magenta}%s. ${c_cyan}%s\n\n${c_default}" "${1}" "${2}" "${3}" "${4}"
} }
# Check command availability
has_command() {
command -v "$1" &> /dev/null
}
has_flatpak_app() {
flatpak list --columns=application | grep "${1}" &> /dev/null || return 1
}
has_snap_app() {
snap list "${1}" &> /dev/null || return 1
}
is_my_distro() {
[[ "$(cat '/etc/os-release' | awk -F '=' '/ID/{print $2}')" =~ "${1}" ]]
}
############################################################################### ###############################################################################
# PARAMETERS # # PARAMETERS #
############################################################################### ###############################################################################