feat(main): changed to functions

This commit is contained in:
Paul Fey 2025-03-30 21:11:28 +02:00
parent b74fb85125
commit c447b1707b

9
main
View file

@ -31,6 +31,7 @@ if [ -d "$HOME/.local/bin" ]; then
fi
#
# Detect Device Arch
get_architecture() {
arch="$(uname -m | tr '[:upper:]' '[:lower:]')"
case "${arch}" in
@ -44,14 +45,20 @@ esac
if [ "${arch}" = "arm64" ] && [ "$(getconf LONG_BIT)" -eq 32 ]; then
arch=arm
fi
echo "$arch"
}
#
# Detect Device Platform
get_platform() {
platform="$(uname -s | awk '{print tolower($0)}')"
case "${platform}" in
linux) platform="linux" ;;
darwin) platform="darwin" ;;
esac
echo "$platform"
}
#
# Set the OMP Path and create the directory
OMP_PATH="$HOME/.config/dotfiles/oh-my-posh"
@ -61,7 +68,7 @@ OMP_PATH="$HOME/.config/dotfiles/oh-my-posh"
OMP_THEME_PATH="$OMP_PATH/$OMP_THEME.toml"
#
# Set the OMP target Platform
OMP_TARGET="$platform-$arch"
OMP_TARGET="$(get_platform)-$(get_architecture)"
#
# Set the path to the OMP Executeable
OMP_EXE="$OMP_PATH/posh-$OMP_TARGET"