chore(lint): linting, tweaks, cleanup

This commit is contained in:
2023-09-25 12:17:14 +03:00
parent 748e5bb561
commit 54948b112e
9 changed files with 44 additions and 48 deletions

View File

@@ -19,4 +19,3 @@ include:
exclude: exclude:
- ./tools/** - ./tools/**
- ./config/nvim/**

24
base/bashrc Normal file → Executable file
View File

@@ -7,19 +7,27 @@ export DOTFILES="$HOME/.dotfiles"
# Run x-load-configs in your terminal to reload the files. # Run x-load-configs in your terminal to reload the files.
function x-load-configs() function x-load-configs()
{ {
# Load the shell dotfiles, and then some:
for file in $DOTFILES/config/{exports,alias,functions}; do
HOST="$(hostname -s)" HOST="$(hostname -s)"
# Load the shell dotfiles, and then some: # global (exports|alias|functions) file for all hosts
for file in $DOTFILES/config/{exports,alias,functions}; do # shellcheck source=../config/exports
[ -r "$file" ] && source "$file" [ -r "$file" ] && source "$file"
[ -r "$file-secret" ] && source "$file-secret" # global secret file, git ignored
[ -r "$file-$HOST" ] && source "$file-$HOST" # shellcheck source=../config/exports-secret
[ -r "$file-$HOST-secret" ] && source "$file-$HOST-secret" [ -r "$file-secret" ] && source "$file-secret"
done # host specific (exports|alias|functions) file
# shellcheck source=../config/exports
[ -r "$file-$HOST" ] && source "$file-$HOST"
# host specific (exports|alias|functions) file, git ignored
# shellcheck source=../config/exports
[ -r "$file-$HOST-secret" ] && source "$file-$HOST-secret"
done
} }
x-load-configs x-load-configs
# Import ssh keys in keychain # Import ssh keys in keychain
ssh-add -A 2>/dev/null; ssh-add -A 2> /dev/null
# shellcheck source=../config/fzf/fzf.bash # shellcheck source=../config/fzf/fzf.bash
[ -f "${DOTFILES}/config/fzf/fzf.bash" ] \ [ -f "${DOTFILES}/config/fzf/fzf.bash" ] \

4
base/zshrc Normal file → Executable file
View File

@@ -42,8 +42,7 @@ x-dc "$ZSH_CUSTOM_COMPLETION_PATH"
FPATH="$ZSH_CUSTOM_COMPLETION_PATH:$FPATH" FPATH="$ZSH_CUSTOM_COMPLETION_PATH:$FPATH"
autoload -Uz compinit autoload -Uz compinit
if type brew &>/dev/null if type brew &> /dev/null; then
then
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
fi fi
@@ -70,4 +69,3 @@ have antigen && {
# Start starship # Start starship
eval "$(starship init zsh)" eval "$(starship init zsh)"

View File

@@ -1,3 +1,4 @@
---
# Configuration for Alacritty, the GPU enhanced terminal emulator # Configuration for Alacritty, the GPU enhanced terminal emulator
# Any items in the `env` entry below will be added as # Any items in the `env` entry below will be added as

View File

@@ -27,9 +27,9 @@ git submodule update --init --recursive "${DOTBOT_DIR}"
if [ "${DOTBOT_HOST}" != "" ]; then if [ "${DOTBOT_HOST}" != "" ]; then
DOTBOT_HOST_CONFIG="${BASEDIR}/hosts/${DOTBOT_HOST}/${CONFIG}" DOTBOT_HOST_CONFIG="${BASEDIR}/hosts/${DOTBOT_HOST}/${CONFIG}"
echo "-> Trying if host config can be found: ${DOTBOT_HOST_CONFIG}" echo "-> Trying if host config can be found: ${DOTBOT_HOST_CONFIG}"
[ -r "$DOTBOT_HOST_CONFIG" ] && [ -f "$DOTBOT_HOST_CONFIG" ] && [ -r "$DOTBOT_HOST_CONFIG" ] && [ -f "$DOTBOT_HOST_CONFIG" ] \
echo "(!) Found $DOTBOT_HOST_CONFIG" && && echo "(!) Found $DOTBOT_HOST_CONFIG" \
"$DOTBOT_BIN_PATH" \ && "$DOTBOT_BIN_PATH" \
-d "$BASEDIR" \ -d "$BASEDIR" \
--plugin-dir=tools/dotbot-brew \ --plugin-dir=tools/dotbot-brew \
--plugin-dir=tools/dotbot-include \ --plugin-dir=tools/dotbot-include \

View File

@@ -250,10 +250,8 @@ function section_dotfiles
~/.local/share/nvim \ ~/.local/share/nvim \
~/.local/state/nvim \ ~/.local/state/nvim \
~/.cache/nvim \ ~/.cache/nvim \
~/.config/astronvim \
~/.config/nvim ~/.config/nvim
msg_ok "Deleted old nvim files" msg_ok "Deleted old nvim files (share, state and cache + config)"
ln -s "$DOTFILES/config/astronvim" ~/.config/astronvim
ln -s "$DOTFILES/config/nvim" ~/.config/nvim ln -s "$DOTFILES/config/nvim" ~/.config/nvim
msg_ok "Linked nvim and astronvim" msg_ok "Linked nvim and astronvim"
have npm && $0 install npm have npm && $0 install npm

View File

@@ -16,21 +16,22 @@ COLOR_S='\033[0;36m'
RESET='\033[0m' RESET='\033[0m'
# Print time-based personalized message, using figlet & lolcat if availible # Print time-based personalized message, using figlet & lolcat if availible
function welcome_greeting () { function welcome_greeting()
{
h=$(date +%H) h=$(date +%H)
if [ "$h" -lt 04 ] || [ "$h" -gt 22 ]; if [ "$h" -lt 04 ] || [ "$h" -gt 22 ]; then
then greeting="Good Night" greeting="Good Night"
elif [ "$h" -lt 12 ]; elif [ "$h" -lt 12 ]; then
then greeting="Good morning" greeting="Good morning"
elif [ "$h" -lt 18 ]; elif [ "$h" -lt 18 ]; then
then greeting="Good afternoon" greeting="Good afternoon"
elif [ "$h" -lt 22 ]; elif [ "$h" -lt 22 ]; then
then greeting="Good evening" greeting="Good evening"
else else
greeting="Hello" greeting="Hello"
fi fi
WELCOME_MSG="$greeting $USER!" WELCOME_MSG="$greeting $USER!"
if hash lolcat 2>/dev/null && hash figlet 2>/dev/null; then if hash lolcat 2> /dev/null && hash figlet 2> /dev/null; then
echo "${WELCOME_MSG}" | figlet | lolcat echo "${WELCOME_MSG}" | figlet | lolcat
else else
echo -e "$COLOR_P${WELCOME_MSG}${RESET}\n" echo -e "$COLOR_P${WELCOME_MSG}${RESET}\n"
@@ -38,8 +39,9 @@ function welcome_greeting () {
} }
# Print system information with neofetch, if it's installed # Print system information with neofetch, if it's installed
function welcome_sysinfo () { function welcome_sysinfo()
if hash neofetch 2>/dev/null; then {
if hash neofetch 2> /dev/null; then
neofetch --shell_version off \ neofetch --shell_version off \
--disable kernel distro shell resolution cpu gpu de wm wm_theme theme icons terminal \ --disable kernel distro shell resolution cpu gpu de wm wm_theme theme icons terminal \
--backend off \ --backend off \
@@ -50,7 +52,8 @@ function welcome_sysinfo () {
} }
# Print todays info: Date, IP, weather, etc # Print todays info: Date, IP, weather, etc
function welcome_today () { function welcome_today()
{
timeout=1 timeout=1
echo -e "\033[1;34mToday\n------" echo -e "\033[1;34mToday\n------"
@@ -62,7 +65,7 @@ function welcome_today () {
echo -e "${RESET}" echo -e "${RESET}"
# Print IP address # Print IP address
if hash ip 2>/dev/null; then if hash ip 2> /dev/null; then
ip_address=$(ip route get 8.8.8.8 | awk -F"src " 'NR==1{split($2,a," ");print a[1]}') ip_address=$(ip route get 8.8.8.8 | awk -F"src " 'NR==1{split($2,a," ");print a[1]}')
ip_interface=$(ip route get 8.8.8.8 | awk -F"dev " 'NR==1{split($2,a," ");print a[1]}') ip_interface=$(ip route get 8.8.8.8 | awk -F"dev " 'NR==1{split($2,a," ");print a[1]}')
echo -e "${COLOR_S}🌐 IP: $(curl -s -m $timeout 'https://ipinfo.io/ip') (${ip_address} on ${ip_interface})" echo -e "${COLOR_S}🌐 IP: $(curl -s -m $timeout 'https://ipinfo.io/ip') (${ip_address} on ${ip_interface})"
@@ -71,23 +74,11 @@ function welcome_today () {
} }
# Putting it all together # Putting it all together
function welcome() { function welcome()
{
welcome_greeting welcome_greeting
welcome_sysinfo welcome_sysinfo
welcome_today welcome_today
} }
# Determine if file is being run directly or sourced welcome "$@"
([[ -n $ZSH_EVAL_CONTEXT && $ZSH_EVAL_CONTEXT =~ :file$ ]] \
|| [[ -n $KSH_VERSION && $(cd "$(dirname -- "$0")" \
&& printf '%s' "${PWD%/}/")$(basename -- "$0") != "${.sh.file}" ]] \
|| [[ -n $BASH_VERSION ]] && (return 0 2>/dev/null)
) && sourced=1 || sourced=0
# If script being called directly run immediately
if [ "$sourced" -eq 0 ]; then
welcome "$@"
fi
# EOF

View File

@@ -29,7 +29,7 @@ for pkg in "${packages[@]}"; do
# Skip comments # Skip comments
if [[ ${pkg:0:1} == "#" ]]; then continue; fi if [[ ${pkg:0:1} == "#" ]]; then continue; fi
msg "Installing cargo package $pkg" msg_run "Installing cargo package $pkg"
cargo install "$pkg" cargo install "$pkg"
echo "" echo ""

View File

@@ -9,6 +9,7 @@ source "$HOME/.dotfiles/scripts/shared.sh"
} }
packages=( packages=(
"pipx"
"libtmux" "libtmux"
) )