dotfiles/vim/templates/skeleton.sh

49 lines
859 B
Bash
Raw Normal View History

2020-07-25 23:39:09 +00:00
#!/usr/bin/env bash
2017-07-26 16:06:00 +00:00
if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
2020-07-26 17:58:29 +00:00
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)"
MAGENTA="$(tput setaf 5)"
CYAN="$(tput setaf 6)"
BOLD="$(tput bold)"
NORMAL="$(tput sgr0)"
2017-07-26 16:06:00 +00:00
else
2020-07-26 17:58:29 +00:00
RED=""
GREEN=""
YELLOW=""
BLUE=""
MAGENTA=""
CYAN=""
BOLD=""
NORMAL=""
2017-07-26 16:06:00 +00:00
fi
2017-08-24 03:35:26 +00:00
error() {
2020-07-26 17:58:29 +00:00
printf "${BOLD}${RED}$1${NORMAL}\n"
2017-08-24 03:35:26 +00:00
}
abort() {
2020-07-26 17:58:29 +00:00
error "\nAborting..."
exit 1
2017-08-24 03:35:26 +00:00
}
2017-07-26 16:06:00 +00:00
set -e
cwd=$PWD
2019-05-15 18:00:25 +00:00
uname_s="$(uname -s)"
case "${uname_s}" in
Linux*) machine=Linux;;
2020-07-26 17:58:29 +00:00
Darwin*) machine=MacOS;;
2019-05-15 18:00:25 +00:00
CYGWIN*) machine=Cygwin;;
MINGW*) machine=MinGw;;
*) machine="UNKNOWN:${uname_s}"
esac
printf "${YELLOW}Platform: $machine${NORMAL}\n"