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,9 +6,8 @@
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
by default will download all packages listed below by default will download all packages listed below
@ -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

@ -24,14 +24,13 @@ fi
# start some nice programs # start some nice programs
if [ -d /etc/X11/xinit/xinitrc.d ] ; then if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do for f in /etc/X11/xinit/xinitrc.d/?*.sh; do
[ -x "$f" ] && . "$f" [ -x "$f" ] && . "$f"
done done
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)
@ -46,24 +45,24 @@ not_leftwm() {
# i.e. startx qtile # i.e. startx qtile
case $2 in case $2 in
leftwm) leftwm)
export DESKTOP_SESSION=leftwm export DESKTOP_SESSION=leftwm
exec leftwm exec leftwm
;; ;;
plasma) plasma)
export DESKTOP_SESSION=plasma export DESKTOP_SESSION=plasma
exec startplasma-x11 exec startplasma-x11
;; ;;
xmonad) xmonad)
export DESKTOP_SESSION=xmonad export DESKTOP_SESSION=xmonad
xmonad xmonad
;; ;;
qtile) qtile)
not_leftwm not_leftwm
export DESKTOP_SESSION=qtile export DESKTOP_SESSION=qtile
exec qtile start exec qtile start
;; ;;
*) *)
not_leftwm not_leftwm
export DESKTOP_SESSION=qtile export DESKTOP_SESSION=qtile
;; ;;

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"
@ -57,7 +58,7 @@ sleep 0.1
i3lock \ i3lock \
-n \ -n \
--screen 1 \ --screen 1 \
\ \
--color $bg_color \ --color $bg_color \
--inside-color ffffff00 \ --inside-color ffffff00 \
--ring-color $green \ --ring-color $green \
@ -70,19 +71,18 @@ i3lock \
--keyhl-color $cyan \ --keyhl-color $cyan \
--bshl-color $red \ --bshl-color $red \
--wrong-color $red \ --wrong-color $red \
\ \
--ind-pos x+w-5-r:y+h-10-r \ --ind-pos x+w-5-r:y+h-10-r \
--ring-width 25 \ --ring-width 25 \
--radius 100 \ --radius 100 \
--verif-text "" \ --verif-text "" \
\ \
--greeter-text "$(make_figlet)" \ --greeter-text "$(make_figlet)" \
--greeter-font "${font}" \ --greeter-font "${font}" \
--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

@ -14,7 +14,7 @@
# bindkey -s '^o' 'lfcd\n' # zsh # bindkey -s '^o' 'lfcd\n' # zsh
# #
lfcd () { lfcd() {
tmp="$(mktemp)" tmp="$(mktemp)"
lf -last-dir-path="$tmp" "$@" lf -last-dir-path="$tmp" "$@"
if [ -f "$tmp" ]; then if [ -f "$tmp" ]; then

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
@ -28,22 +25,21 @@ get_extensions() {
} }
write_bat() { write_bat() {
echo "call code --install-extension $1 --force" >> install-extensions.bat echo "call code --install-extension $1 --force" >>install-extensions.bat
} }
write_sh() { 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
echo >> install-extensions.bat echo >>install-extensions.bat
echo "echo Installing VSCode extensions" >> install-extensions.bat echo "echo Installing VSCode extensions" >>install-extensions.bat
echo "#!/usr/bin/env bash" > install-extensions.sh echo "#!/usr/bin/env bash" >install-extensions.sh
echo >> install-extensions.sh echo >>install-extensions.sh
echo "echo Installing VSCode extensions" >> install-extensions.sh echo "echo Installing VSCode extensions" >>install-extensions.sh
# read extensions and write install scripts # read extensions and write install scripts
get_extensions get_extensions