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
case $(tty) in /dev/tty[0-9]*)
exit 0;;
exit 0
;;
*)
exit 1;;
exit 1
;;
esac

View file

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

View file

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

View file

@ -1,5 +1,6 @@
#!/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
fi
# colors
@ -41,9 +42,9 @@ make_figlet() {
}
font_size=25
font_to_px=$(( $font_size * 16 / 12 ))
greeter_h=$(($(make_figlet | wc -l) * $font_to_px))
greeter_w=$(($(make_figlet | wc -L ) * $font_to_px))
font_to_px=$((font_size * 16 / 12))
greeter_h=$(($(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"
@ -81,8 +82,7 @@ i3lock \
--greeter-size $font_size \
--greeter-color $cyan \
--greeter-pos "${greeter_pos}" \
--greeter-align 1 \
--greeter-align 1
# resume message display
pkill -u "$USER" -USR2 dunst

View file

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

View file

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