run shfmt on .bashrc and bootstrap.sh

This commit is contained in:
2022-02-08 19:36:10 +03:00
parent 578a5bbf66
commit dbf0f68ef3
2 changed files with 68 additions and 70 deletions

View File

@@ -28,23 +28,21 @@ declare -A configs=(
bashCompletionsDir="$HOME/.config/bash-completions"
__install_bash_completions() {
if [[ ! -d "$bashCompletionsDir" ]] ; then
if [[ ! -d "$bashCompletionsDir" ]]; then
mkdir "$bashCompletionsDir"
fi
for cmp in "${!bashCompletions[@]}"
do
for cmp in "${!bashCompletions[@]}"; do
source=${bashCompletions[$cmp]}
dest="$bashCompletionsDir/$cmp.bash"
if [[ ! -f "$dest" ]] ; then
if [[ ! -f "$dest" ]]; then
echo "Downloading $cmp completion"
curl "$source" -o "$dest" &> /dev/null
curl "$source" -o "$dest" &>/dev/null
fi
done
}
usage() {
echo "usage: (./)bootstrap.sh [-S][-R]"
echo
@@ -53,15 +51,14 @@ usage() {
echo " -I downloads bash completions"
}
if [ $# -eq 0 ] ; then
if [ $# -eq 0 ]; then
usage
fi
# Install all configs
if [ "$1" = "-S" ] ; then
if [ "$1" = "-S" ]; then
# Create symlinks
for config in "${!configs[@]}"
do
for config in "${!configs[@]}"; do
ln -s $config ${configs[$config]}
done
@@ -73,23 +70,21 @@ if [ "$1" = "-S" ] ; then
# Install vim plugins
nvim -c "PackerInstall"
if [[ ! -d "$bashCompletionsDir" ]] ; then
if [[ ! -d "$bashCompletionsDir" ]]; then
__install_bash_completions
fi
fi
# Remove all configs
if [ "$1" = "-R" ] ; then
for config in "${!configs[@]}"
do
if [ "$1" = "-R" ]; then
for config in "${!configs[@]}"; do
rm -rf ${configs[$config]}
done
rm -rf "$bashCompletionsDir"
fi
# Install bash completions defined in hashmap above
if [ "$1" = "-I" ] ; then
if [ "$1" = "-I" ]; then
__install_bash_completions
fi

View File

@@ -10,7 +10,7 @@
export DOTFILES="$HOME/dotfiles"
export TERM=alacritty
export TERM=kitty
export EDITOR=nvim
export VISUAL=nvim
@@ -26,7 +26,6 @@ PYTHON_BIN="$HOME/.local/bin"
export PATH="$PATH:$MY_BIN:$PYTHON_BIN:$RUSTBIN:$GOBIN"
# Source bash completions
source $HOME/.config/bash-completions/*
@@ -50,3 +49,7 @@ set -o vi
# Show calendar and date on start
cal -m
date +"%d %B %Y - %H:%M:%S, %A"
# BEGIN_KITTY_SHELL_INTEGRATION
if test -n "$KITTY_INSTALLATION_DIR" -a -e "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"; then source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"; fi
# END_KITTY_SHELL_INTEGRATION