MIAOU-BASH is a collection of scripts and configurations designed to enhance your terminal experience. As the name suggests, it is built on Bash and is designed to work on most modern GNU/Linux systems.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.6 KiB

# CONSTANTS
# FUNCTIONS
function bash_version {
bash --version | head -n1 | cut -d ' ' -f4 | grep -oE '[0-9]+\.[0-9]+\.[0-9]+'
}
function distribution {
grep ^ID= /etc/os-release | cut -d= -f2
}
function debian_version {
grep ^VERSION= /etc/os-release | cut -d= -f2
}
function zone_info {
if [[ -e /etc/localtime ]]; then
realpath /etc/localtime --relative-to=/usr/share/zoneinfo
else
echo '<undefined>'
fi
}
function azerty_mode {
if [[ -f /etc/vim/vimrc.azerty ]]; then echo true; else echo false; fi
}
function print_value {
printf "%25s = %s\n" "$@"
}
function doctor_distribution {
echo '-- distribution --'
fetch_distro_like
print_value 'FAMILY' "$DISTRO_LIKE"
distro_name=$(distribution)
print_value 'NAME' "$distro_name"
if [[ $distro_name == 'debian' ]]; then
print_value 'VERSION' "$(debian_version)"
fi
}
function doctor_miaou {
echo '-- miaou --'
print_value MIAOU_BASH_DIR "$MIAOU_BASH_DIR"
print_value MIAOU_BASH_MODE "$MIAOU_BASH_MODE"
print_value MIAOU_BASH_MODE_OWNER "$MIAOU_BASH_MODE_OWNER"
print_value "AZERTY mode" "$(azerty_mode)"
}
function doctor_environment {
echo '-- environment --'
print_value BASH_VERSION "$(bash_version)"
print_value TERM "${TERM:-}"
print_value LANG "${LANG:-}"
print_value REGION "$(zone_info)"
print_value USER "$USER"
print_value HOSTNAME "$(hostname -f)"
}
function doctor_test_suite {
echo '-- test suite --'
"$MIAOU_BASH_DIR"/test/miaou-bash.test.bash 2>&1
}
# MAIN
source "$MIAOU_BASH_DIR"/lib/functions.bash
echo '== MIAOU DOCTOR =='
fetch_mode
doctor_distribution
doctor_environment
doctor_miaou
doctor_test_suite