Move OS detection to a function and cleanup comments

This commit is contained in:
Dylan Araps 2016-08-13 21:28:23 +10:00
parent 256205aaea
commit 66749c58ab
1 changed files with 12 additions and 26 deletions

View File

@ -19,12 +19,11 @@ export LANG=C
# Set no case match. # Set no case match.
shopt -s nocasematch shopt -s nocasematch
# Gather Info {{{ # Gather Info {{{
# Operating System {{{ # Operating System {{{
getos() {
case "$(uname)" in case "$(uname)" in
"Linux") os="Linux" ;; "Linux") os="Linux" ;;
"Darwin") os="$(sw_vers -productName)" ;; "Darwin") os="$(sw_vers -productName)" ;;
@ -33,6 +32,7 @@ case "$(uname)" in
"SunOS") os="Solaris" ;; "SunOS") os="Solaris" ;;
*) printf "%s\n" "Unknown OS detected: $(uname)"; exit 1 ;; *) printf "%s\n" "Unknown OS detected: $(uname)"; exit 1 ;;
esac esac
}
# }}} # }}}
@ -1764,10 +1764,8 @@ getcols() {
# }}} # }}}
# Images {{{ # Images {{{
# Wallpaper {{{ # Wallpaper {{{
getwallpaper() { getwallpaper() {
@ -2135,13 +2133,10 @@ getimagebackend() {
# }}} # }}}
# }}} # }}}
# Text Formatting {{{ # Text Formatting {{{
# Info {{{ # Info {{{
info() { info() {
@ -2512,13 +2507,10 @@ trim() {
# }}} # }}}
# }}} # }}}
# Other {{{ # Other {{{
# Error {{{ # Error {{{
err() { err() {
@ -2696,13 +2688,10 @@ dynamicprompt() {
# }}} # }}}
# }}} # }}}
# Usage {{{ # Usage {{{
usage() { cat << EOF usage() { cat << EOF
usage: neofetch --option "value" --option "value" usage: neofetch --option "value" --option "value"
@ -2834,13 +2823,10 @@ EOF
exit 1 exit 1
} }
# }}} # }}}
# Args {{{ # Args {{{
while [ "$1" ]; do while [ "$1" ]; do
case $1 in case $1 in
# Info # Info
@ -3026,13 +3012,13 @@ while [ "$1" ]; do
shift shift
done done
# }}} # }}}
# Call Functions and Finish Up {{{ # Call Functions and Finish Up {{{
main() { main() {
getos
# Restore cursor and clear screen on ctrl+c # Restore cursor and clear screen on ctrl+c
trap 'printf "\033[?25h"; clear; exit' 2 trap 'printf "\033[?25h"; clear; exit' 2