Make loading starship in bashrc based on condition - remove starship from depends

This commit is contained in:
dr460nf1r3 2021-07-28 21:50:02 +02:00
parent ab24a7a36f
commit b23d714db9
No known key found for this signature in database
GPG Key ID: BE75B9D9767036C2
2 changed files with 16 additions and 15 deletions

View File

@ -2,8 +2,8 @@
# Maintainer: Librewish <librewish@gmail.com>
pkgname=garuda-common-settings
pkgver=2.0.0
pkgrel=2
pkgver=2.0.1
pkgrel=1
arch=('any')
url="https://gitlab.com/garuda-linux/themes-and-settings/settings/$pkgname"
license=('GPL')
@ -14,7 +14,6 @@ depends=('btrfsmaintenance'
'garuda-browser-settings'
'garuda-hooks'
'garuda-icons'
'garuda-starship-prompt'
'haveged'
'memavaild'
'nohang'

View File

@ -1,19 +1,21 @@
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
# Load starship prompt
__main() {
local major="${BASH_VERSINFO[0]}"
local minor="${BASH_VERSINFO[1]}"
# Load starship prompt if starship is installed
if [ -x /usr/bin/starship ]; then
__main() {
local major="${BASH_VERSINFO[0]}"
local minor="${BASH_VERSINFO[1]}"
if ((major > 4)) || { ((major == 4)) && ((minor >= 1)); }; then
source <("/usr/bin/starship" init bash --print-full-init)
else
source /dev/stdin <<<"$("/usr/bin/starship" init bash --print-full-init)"
fi
}
__main
unset -f __main
if ((major > 4)) || { ((major == 4)) && ((minor >= 1)); }; then
source <("/usr/bin/starship" init bash --print-full-init)
else
source /dev/stdin <<<"$("/usr/bin/starship" init bash --print-full-init)"
fi
}
__main
unset -f __main
fi
# Aliases
alias dir='dir --color=auto'