pfetch: iOS support

This commit is contained in:
Dylan Araps 2019-10-01 10:01:02 +03:00
parent c20823937c
commit 987d3b61fd

26
pfetch
View File

@ -210,19 +210,27 @@ get_os() {
# says "populate $line with the third field's contents". # says "populate $line with the third field's contents".
while IFS='<>' read -r _ _ line _; do while IFS='<>' read -r _ _ line _; do
case $line in case $line in
# Match 'ProductVersion' and read the next line # Match the key and read the next line
# directly as it contains the key's value. # directly as it contains the key's value.
ProductVersion) #
IFS='<>' read -r _ _ mac_version _ # Define a shell variable using the key's value.
ProductName|ProductVersion)
IFS='<>' read -r _ _ "${line?}" _
break break
;; ;;
esac esac
done < /System/Library/CoreServices/SystemVersion.plist done < /System/Library/CoreServices/SystemVersion.plist
# Use the ProductVersion to determine which macOS/OS X codename case ${ProductName?} in
# the system has. As far as I'm aware there's no "dynamic" way iPhone*)
# of grabbing this information. distro="iOS ${ProductVersion?}"
case $mac_version in ;;
*)
# Use the ProductVersion to determine which macOS/OS X
# codename the system has. As far as I'm aware there's
# no "dynamic" way of grabbing this information.
case ${ProductVersion?} in
10.4*) distro='Mac OS X Tiger' ;; 10.4*) distro='Mac OS X Tiger' ;;
10.5*) distro='Mac OS X Leopard' ;; 10.5*) distro='Mac OS X Leopard' ;;
10.6*) distro='Mac OS X Snow Leopard' ;; 10.6*) distro='Mac OS X Snow Leopard' ;;
@ -238,7 +246,9 @@ get_os() {
*) distro='macOS' ;; *) distro='macOS' ;;
esac esac
distro="$distro $mac_version" distro="$distro ${ProductVersion?}"
;;
esac
;; ;;
Haiku) Haiku)