add shell linting/make

This commit is contained in:
Daylin Morgan 2022-07-06 11:55:14 -05:00
parent c8025c2cde
commit d38e26bf5d
11 changed files with 202 additions and 217 deletions

3
Makefile Normal file
View file

@ -0,0 +1,3 @@
.PHONY: lint
lint:
shfmt -s -w $(shell shfmt -f .)

View file

@ -1,8 +1,9 @@
#!/bin/sh #!/bin/sh
case $(tty) in /dev/tty[0-9]*) case $(tty) in /dev/tty[0-9]*)
exit 0;; exit 0
;;
*) *)
exit 1;; exit 1
;;
esac esac

View file

@ -6,7 +6,6 @@
MAMBAFORGE_RELEASE="https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh" MAMBAFORGE_RELEASE="https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh"
MAMBAFORGE_INSTALLER="Mambaforge-Linux-x86_64.sh" MAMBAFORGE_INSTALLER="Mambaforge-Linux-x86_64.sh"
help() { help() {
cat <<EOF cat <<EOF
extras downloaders extras downloaders
@ -46,7 +45,6 @@ for opt in "$@"; do
esac esac
done done
check_existing() { check_existing() {
pkg=$1 pkg=$1
install_dir=$2 install_dir=$2
@ -66,7 +64,6 @@ check_existing() {
fi fi
} }
ask() { ask() {
while true; do while true; do
read -p "$1 ([y]/n) " -r read -p "$1 ([y]/n) " -r
@ -86,8 +83,7 @@ install_fzf() {
check_existing "fzf" "$HOME/.fzf" skip check_existing "fzf" "$HOME/.fzf" skip
if [[ "$skip" -eq 1 ]]; if [[ $skip -eq 1 ]]; then
then
echo "remove your previous installation or rerun with --force" echo "remove your previous installation or rerun with --force"
return return
fi fi
@ -100,10 +96,10 @@ install_fzf() {
--completion \ --completion \
--no-bash \ --no-bash \
--no-zsh \ --no-zsh \
--no-update-rc \ --no-update-rc
} }
install_nvm() { install_nvm() {
echo "##############" echo "##############"
echo installing nvm echo installing nvm
@ -111,8 +107,7 @@ install_nvm() {
check_existing "nvm" "$HOME/.nvm" skip check_existing "nvm" "$HOME/.nvm" skip
if [[ "$skip" -eq 1 ]]; if [[ $skip -eq 1 ]]; then
then
echo "remove your previous installation or rerun with --force" echo "remove your previous installation or rerun with --force"
return return
fi fi
@ -127,17 +122,14 @@ install_nvm() {
cd $current_dir cd $current_dir
} }
install_mambaforge() { install_mambaforge() {
echo "#####################" echo "#####################"
echo installing mambaforge echo installing mambaforge
echo "#####################" echo "#####################"
check_existing "mambaforge" "$HOME/mambaforge" skip check_existing "mambaforge" "$HOME/mambaforge" skip
if [[ "$skip" -eq 1 ]]; if [[ $skip -eq 1 ]]; then
then
echo "remove your previous installation or rerun with --force" echo "remove your previous installation or rerun with --force"
return return
fi fi
@ -157,8 +149,6 @@ install_mambaforge() {
cd $current_dir cd $current_dir
} }
install_all() { install_all() {
echo "installing all packages..." echo "installing all packages..."
echo echo
@ -178,8 +168,7 @@ echo EXTRAS DOWNLOADER
echo "#################" echo "#################"
echo echo
if [ $# -eq 0 ]; if [ $# -eq 0 ]; then
then
install_all install_all
exit exit
fi fi
@ -192,9 +181,8 @@ if [ "$nvm" ]; then
install_nvm install_nvm
fi fi
if [ "$mamba" ]; if [ "$mamba" ]; then
then install_mambaforge install_mambaforge
fi fi
echo "FINISHED!" echo "FINISHED!"

View file

@ -31,7 +31,6 @@ if [ -d /etc/X11/xinit/xinitrc.d ] ; then
unset f unset f
fi fi
[ -f ~/.xprofile ] && . ~/.xprofile [ -f ~/.xprofile ] && . ~/.xprofile
eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh) eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)

View file

@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
if ! [[ -f /usr/bin/i3lock ]]; then notify-send "no i3lock...install i3lock-color" if ! [[ -f /usr/bin/i3lock ]]; then
notify-send "no i3lock...install i3lock-color"
exit exit
fi fi
# colors # colors
@ -41,9 +42,9 @@ make_figlet() {
} }
font_size=25 font_size=25
font_to_px=$(( $font_size * 16 / 12 )) font_to_px=$((font_size * 16 / 12))
greeter_h=$(($(make_figlet | wc -l) * $font_to_px)) greeter_h=$(($(make_figlet | wc -l) * font_to_px))
greeter_w=$(($(make_figlet | wc -L ) * $font_to_px)) greeter_w=$(($(make_figlet | wc -L) * font_to_px))
greeter_pos="x+w/2-${greeter_w}/4:y+h/2-${greeter_h}/4" greeter_pos="x+w/2-${greeter_w}/4:y+h/2-${greeter_h}/4"
@ -81,8 +82,7 @@ i3lock \
--greeter-size $font_size \ --greeter-size $font_size \
--greeter-color $cyan \ --greeter-color $cyan \
--greeter-pos "${greeter_pos}" \ --greeter-pos "${greeter_pos}" \
--greeter-align 1 \ --greeter-align 1
# resume message display # resume message display
pkill -u "$USER" -USR2 dunst pkill -u "$USER" -USR2 dunst

View file

@ -4,8 +4,6 @@
files=(alacritty.yml dracula.yml dracula-pro.yml) files=(alacritty.yml dracula.yml dracula-pro.yml)
for file in "${files[@]}" for file in "${files[@]}"; do
do
cp -v $DOTFILES_DIR/config/alacritty/$file /mnt/c/Users/daylin/AppData/Roaming/alacritty/$file cp -v $DOTFILES_DIR/config/alacritty/$file /mnt/c/Users/daylin/AppData/Roaming/alacritty/$file
done done

View file

@ -3,8 +3,7 @@
YAMLDOC="extensions.yml" YAMLDOC="extensions.yml"
# check for yq # check for yq
if ! command -v yq &> /dev/null if ! command -v yq &>/dev/null; then
then
echo "yq could not be found" echo "yq could not be found"
echo "to install w/ eget" echo "to install w/ eget"
echo "eget mikefarah/yq" echo "eget mikefarah/yq"
@ -14,13 +13,11 @@ fi
readarray sections < <(yq e 'keys | .[]' $YAMLDOC) readarray sections < <(yq e 'keys | .[]' $YAMLDOC)
get_extensions() { get_extensions() {
for section in "${sections[@]}" for section in "${sections[@]}"; do
do
echo $section echo $section
readarray exts < <(key=$section yq e '.[env(key)] | .[]' $YAMLDOC) readarray exts < <(key=$section yq e '.[env(key)] | .[]' $YAMLDOC)
echo ${exts[@]} echo ${exts[@]}
for ext in "${exts[@]}" for ext in "${exts[@]}"; do
do
write_bat $ext write_bat $ext
write_sh $ext write_sh $ext
done done
@ -35,7 +32,6 @@ write_sh() {
echo "code --install-extension $1 --force" >>install-extensions.sh echo "code --install-extension $1 --force" >>install-extensions.sh
} }
# clean up old files # clean up old files
rm -f install-extensions.{sh,bat} rm -f install-extensions.{sh,bat}
echo "echo off" >install-extensions.bat echo "echo off" >install-extensions.bat