add shell linting/make
This commit is contained in:
parent
c8025c2cde
commit
d38e26bf5d
11 changed files with 202 additions and 217 deletions
3
Makefile
Normal file
3
Makefile
Normal file
|
@ -0,0 +1,3 @@
|
|||
.PHONY: lint
|
||||
lint:
|
||||
shfmt -s -w $(shell shfmt -f .)
|
|
@ -1,8 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if ! $(is-executable yq); then
|
||||
echo "you will need to install yq"
|
||||
echo "see here for more info: https://github.com/mikefarah/yq"
|
||||
echo "you will need to install yq"
|
||||
echo "see here for more info: https://github.com/mikefarah/yq"
|
||||
fi
|
||||
|
||||
YAMLDOC="$HOME/.dotfiles/info/pkgs.yml"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ -x "$(command -v $1)" ]; then
|
||||
exit 0
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
case $(tty) in /dev/tty[0-9]*)
|
||||
exit 0;;
|
||||
*)
|
||||
exit 1;;
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
|
216
extras.sh
216
extras.sh
|
@ -6,9 +6,8 @@
|
|||
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
|
||||
cat <<EOF
|
||||
extras downloaders
|
||||
|
||||
by default will download all packages listed below
|
||||
|
@ -29,144 +28,135 @@ EOF
|
|||
}
|
||||
|
||||
for opt in "$@"; do
|
||||
case $opt in
|
||||
--help)
|
||||
help
|
||||
exit 0
|
||||
;;
|
||||
--force) force=1 ;;
|
||||
--fzf) fzf=1 ;;
|
||||
--nvm) nvm=1 ;;
|
||||
--mambaforge) mamba=1 ;;
|
||||
*)
|
||||
echo "unknown option: $opt"
|
||||
help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
case $opt in
|
||||
--help)
|
||||
help
|
||||
exit 0
|
||||
;;
|
||||
--force) force=1 ;;
|
||||
--fzf) fzf=1 ;;
|
||||
--nvm) nvm=1 ;;
|
||||
--mambaforge) mamba=1 ;;
|
||||
*)
|
||||
echo "unknown option: $opt"
|
||||
help
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
||||
check_existing() {
|
||||
pkg=$1
|
||||
install_dir=$2
|
||||
declare -n skip_out=$3
|
||||
pkg=$1
|
||||
install_dir=$2
|
||||
declare -n skip_out=$3
|
||||
|
||||
if [ -d "$install_dir" ]; then
|
||||
echo "found existing $pkg installation"
|
||||
if [[ "$force" ]]; then
|
||||
echo "removing previous installation"
|
||||
rm -rf $install_dir
|
||||
skip_out=0
|
||||
else
|
||||
skip_out=1
|
||||
fi
|
||||
else
|
||||
skip_out=0
|
||||
fi
|
||||
if [ -d "$install_dir" ]; then
|
||||
echo "found existing $pkg installation"
|
||||
if [[ "$force" ]]; then
|
||||
echo "removing previous installation"
|
||||
rm -rf $install_dir
|
||||
skip_out=0
|
||||
else
|
||||
skip_out=1
|
||||
fi
|
||||
else
|
||||
skip_out=0
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
ask() {
|
||||
while true; do
|
||||
read -p "$1 ([y]/n) " -r
|
||||
REPLY=${REPLY:-"y"}
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
return 1
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
while true; do
|
||||
read -p "$1 ([y]/n) " -r
|
||||
REPLY=${REPLY:-"y"}
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
return 1
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
install_fzf() {
|
||||
echo "##############"
|
||||
echo installing fzf
|
||||
echo "##############"
|
||||
echo "##############"
|
||||
echo installing fzf
|
||||
echo "##############"
|
||||
|
||||
check_existing "fzf" "$HOME/.fzf" skip
|
||||
check_existing "fzf" "$HOME/.fzf" skip
|
||||
|
||||
if [[ "$skip" -eq 1 ]];
|
||||
then
|
||||
echo "remove your previous installation or rerun with --force"
|
||||
return
|
||||
fi
|
||||
if [[ $skip -eq 1 ]]; then
|
||||
echo "remove your previous installation or rerun with --force"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "installing fzf using git"
|
||||
|
||||
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
|
||||
~/.fzf/install \
|
||||
--key-bindings \
|
||||
--completion \
|
||||
--no-bash \
|
||||
--no-zsh \
|
||||
--no-update-rc \
|
||||
echo "installing fzf using git"
|
||||
|
||||
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
|
||||
~/.fzf/install \
|
||||
--key-bindings \
|
||||
--completion \
|
||||
--no-bash \
|
||||
--no-zsh \
|
||||
--no-update-rc
|
||||
|
||||
}
|
||||
|
||||
install_nvm() {
|
||||
echo "##############"
|
||||
echo installing nvm
|
||||
echo "##############"
|
||||
echo "##############"
|
||||
echo installing nvm
|
||||
echo "##############"
|
||||
|
||||
check_existing "nvm" "$HOME/.nvm" skip
|
||||
check_existing "nvm" "$HOME/.nvm" skip
|
||||
|
||||
if [[ "$skip" -eq 1 ]];
|
||||
then
|
||||
echo "remove your previous installation or rerun with --force"
|
||||
return
|
||||
fi
|
||||
if [[ $skip -eq 1 ]]; then
|
||||
echo "remove your previous installation or rerun with --force"
|
||||
return
|
||||
fi
|
||||
|
||||
local current_dir=$PWD
|
||||
local current_dir=$PWD
|
||||
|
||||
git clone https://github.com/nvm-sh/nvm.git ~/.nvm
|
||||
cd ~/.nvm
|
||||
git checkout v0.39.0
|
||||
. ./nvm.sh
|
||||
git clone https://github.com/nvm-sh/nvm.git ~/.nvm
|
||||
cd ~/.nvm
|
||||
git checkout v0.39.0
|
||||
. ./nvm.sh
|
||||
|
||||
cd $current_dir
|
||||
cd $current_dir
|
||||
}
|
||||
|
||||
|
||||
install_mambaforge() {
|
||||
echo "#####################"
|
||||
echo installing mambaforge
|
||||
echo "#####################"
|
||||
echo "#####################"
|
||||
echo installing mambaforge
|
||||
echo "#####################"
|
||||
|
||||
check_existing "mambaforge" "$HOME/mambaforge" skip
|
||||
|
||||
check_existing "mambaforge" "$HOME/mambaforge" skip
|
||||
if [[ $skip -eq 1 ]]; then
|
||||
echo "remove your previous installation or rerun with --force"
|
||||
return
|
||||
fi
|
||||
|
||||
if [[ "$skip" -eq 1 ]];
|
||||
then
|
||||
echo "remove your previous installation or rerun with --force"
|
||||
return
|
||||
fi
|
||||
echo "fetching install script from github"
|
||||
|
||||
echo "fetching install script from github"
|
||||
current_dir=$PWD
|
||||
|
||||
current_dir=$PWD
|
||||
cd ~/
|
||||
|
||||
cd ~/
|
||||
wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh
|
||||
bash "$MAMBAFORGE_INSTALLER" -s
|
||||
rm "$MAMBAFORGE_INSTALLER"
|
||||
|
||||
wget https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Linux-x86_64.sh
|
||||
bash "$MAMBAFORGE_INSTALLER" -s
|
||||
rm "$MAMBAFORGE_INSTALLER"
|
||||
echo "cleaning up installer"
|
||||
|
||||
echo "cleaning up installer"
|
||||
|
||||
cd $current_dir
|
||||
cd $current_dir
|
||||
}
|
||||
|
||||
|
||||
|
||||
install_all() {
|
||||
echo "installing all packages..."
|
||||
echo
|
||||
install_fzf
|
||||
echo
|
||||
install_nvm
|
||||
echo
|
||||
install_mambaforge
|
||||
echo "installing all packages..."
|
||||
echo
|
||||
install_fzf
|
||||
echo
|
||||
install_nvm
|
||||
echo
|
||||
install_mambaforge
|
||||
|
||||
}
|
||||
|
||||
|
@ -174,27 +164,25 @@ install_all() {
|
|||
echo $@
|
||||
|
||||
echo "#################"
|
||||
echo EXTRAS DOWNLOADER
|
||||
echo EXTRAS DOWNLOADER
|
||||
echo "#################"
|
||||
echo
|
||||
|
||||
if [ $# -eq 0 ];
|
||||
then
|
||||
install_all
|
||||
exit
|
||||
if [ $# -eq 0 ]; then
|
||||
install_all
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ "$fzf" ]; then
|
||||
install_fzf
|
||||
install_fzf
|
||||
fi
|
||||
|
||||
if [ "$nvm" ]; then
|
||||
install_nvm
|
||||
install_nvm
|
||||
fi
|
||||
|
||||
if [ "$mamba" ];
|
||||
then install_mambaforge
|
||||
if [ "$mamba" ]; then
|
||||
install_mambaforge
|
||||
fi
|
||||
|
||||
|
||||
echo "FINISHED!"
|
||||
|
|
|
@ -7,38 +7,37 @@ sysmodmap=/etc/X11/xinit/.Xmodmap
|
|||
# merge in defaults and keymaps
|
||||
|
||||
if [ -f $sysresources ]; then
|
||||
xrdb -merge $sysresources
|
||||
xrdb -merge $sysresources
|
||||
fi
|
||||
|
||||
if [ -f $sysmodmap ]; then
|
||||
xmodmap $sysmodmap
|
||||
xmodmap $sysmodmap
|
||||
fi
|
||||
|
||||
if [ -f "$userresources" ]; then
|
||||
xrdb -merge "$userresources"
|
||||
xrdb -merge "$userresources"
|
||||
fi
|
||||
|
||||
if [ -f "$usermodmap" ]; then
|
||||
xmodmap "$usermodmap"
|
||||
xmodmap "$usermodmap"
|
||||
fi
|
||||
|
||||
# start some nice programs
|
||||
|
||||
if [ -d /etc/X11/xinit/xinitrc.d ] ; then
|
||||
for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
|
||||
[ -x "$f" ] && . "$f"
|
||||
done
|
||||
unset f
|
||||
if [ -d /etc/X11/xinit/xinitrc.d ]; then
|
||||
for f in /etc/X11/xinit/xinitrc.d/?*.sh; do
|
||||
[ -x "$f" ] && . "$f"
|
||||
done
|
||||
unset f
|
||||
fi
|
||||
|
||||
|
||||
[ -f ~/.xprofile ] && . ~/.xprofile
|
||||
|
||||
eval $(/usr/bin/gnome-keyring-daemon --start --components=pkcs11,secrets,ssh)
|
||||
export SSH_AUTH_SOCK
|
||||
|
||||
not_leftwm() {
|
||||
unclutter --timeout 1 &
|
||||
unclutter --timeout 1 &
|
||||
}
|
||||
|
||||
# $1 is xterm
|
||||
|
@ -46,25 +45,25 @@ not_leftwm() {
|
|||
# i.e. startx qtile
|
||||
|
||||
case $2 in
|
||||
leftwm)
|
||||
export DESKTOP_SESSION=leftwm
|
||||
exec leftwm
|
||||
;;
|
||||
plasma)
|
||||
export DESKTOP_SESSION=plasma
|
||||
exec startplasma-x11
|
||||
;;
|
||||
xmonad)
|
||||
export DESKTOP_SESSION=xmonad
|
||||
xmonad
|
||||
;;
|
||||
qtile)
|
||||
not_leftwm
|
||||
export DESKTOP_SESSION=qtile
|
||||
exec qtile start
|
||||
;;
|
||||
*)
|
||||
not_leftwm
|
||||
export DESKTOP_SESSION=qtile
|
||||
;;
|
||||
leftwm)
|
||||
export DESKTOP_SESSION=leftwm
|
||||
exec leftwm
|
||||
;;
|
||||
plasma)
|
||||
export DESKTOP_SESSION=plasma
|
||||
exec startplasma-x11
|
||||
;;
|
||||
xmonad)
|
||||
export DESKTOP_SESSION=xmonad
|
||||
xmonad
|
||||
;;
|
||||
qtile)
|
||||
not_leftwm
|
||||
export DESKTOP_SESSION=qtile
|
||||
exec qtile start
|
||||
;;
|
||||
*)
|
||||
not_leftwm
|
||||
export DESKTOP_SESSION=qtile
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
@ -55,34 +56,33 @@ sleep 0.1
|
|||
|
||||
# lock the screen
|
||||
i3lock \
|
||||
-n \
|
||||
-n \
|
||||
--screen 1 \
|
||||
\
|
||||
\
|
||||
--color $bg_color \
|
||||
--inside-color ffffff00 \
|
||||
--inside-color ffffff00 \
|
||||
--ring-color $green \
|
||||
--ringwrong-color $red \
|
||||
--ringver-color $cyan \
|
||||
--insidewrong-color $bg_color \
|
||||
--insidever-color $bg_color \
|
||||
--line-uses-ring \
|
||||
--separator-color $selection \
|
||||
--line-uses-ring \
|
||||
--separator-color $selection \
|
||||
--keyhl-color $cyan \
|
||||
--bshl-color $red \
|
||||
--wrong-color $red \
|
||||
\
|
||||
--ind-pos x+w-5-r:y+h-10-r \
|
||||
--ring-width 25 \
|
||||
--radius 100 \
|
||||
\
|
||||
--ind-pos x+w-5-r:y+h-10-r \
|
||||
--ring-width 25 \
|
||||
--radius 100 \
|
||||
--verif-text "" \
|
||||
\
|
||||
--greeter-text "$(make_figlet)" \
|
||||
\
|
||||
--greeter-text "$(make_figlet)" \
|
||||
--greeter-font "${font}" \
|
||||
--greeter-size $font_size \
|
||||
--greeter-color $cyan \
|
||||
--greeter-pos "${greeter_pos}" \
|
||||
--greeter-align 1 \
|
||||
--greeter-pos "${greeter_pos}" \
|
||||
--greeter-align 1
|
||||
|
||||
# resume message display
|
||||
pkill -u "$USER" -USR2 dunst
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -14,16 +14,16 @@
|
|||
# bindkey -s '^o' 'lfcd\n' # zsh
|
||||
#
|
||||
|
||||
lfcd () {
|
||||
tmp="$(mktemp)"
|
||||
lf -last-dir-path="$tmp" "$@"
|
||||
if [ -f "$tmp" ]; then
|
||||
dir="$(cat "$tmp")"
|
||||
rm -f "$tmp"
|
||||
if [ -d "$dir" ]; then
|
||||
if [ "$dir" != "$(pwd)" ]; then
|
||||
cd "$dir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
lfcd() {
|
||||
tmp="$(mktemp)"
|
||||
lf -last-dir-path="$tmp" "$@"
|
||||
if [ -f "$tmp" ]; then
|
||||
dir="$(cat "$tmp")"
|
||||
rm -f "$tmp"
|
||||
if [ -d "$dir" ]; then
|
||||
if [ "$dir" != "$(pwd)" ]; then
|
||||
cd "$dir"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
function cl() {
|
||||
DIR="$*"
|
||||
# if no DIR given, go home
|
||||
if [ $# -lt 1 ]; then
|
||||
DIR=$HOME
|
||||
if [ $# -lt 1 ]; then
|
||||
DIR=$HOME
|
||||
fi
|
||||
builtin cd "${DIR}" &&
|
||||
# use your preferred ls command
|
||||
|
@ -75,5 +75,5 @@ py2nb2html() {
|
|||
|
||||
alias bathelp='bat --plain --language=help'
|
||||
help() {
|
||||
"$@" --help 2>&1 | bathelp
|
||||
"$@" --help 2>&1 | bathelp
|
||||
}
|
||||
|
|
|
@ -3,47 +3,43 @@
|
|||
YAMLDOC="extensions.yml"
|
||||
|
||||
# check for yq
|
||||
if ! command -v yq &> /dev/null
|
||||
then
|
||||
echo "yq could not be found"
|
||||
echo "to install w/ eget"
|
||||
echo "eget mikefarah/yq"
|
||||
exit
|
||||
if ! command -v yq &>/dev/null; then
|
||||
echo "yq could not be found"
|
||||
echo "to install w/ eget"
|
||||
echo "eget mikefarah/yq"
|
||||
exit
|
||||
fi
|
||||
|
||||
readarray sections < <(yq e 'keys | .[]' $YAMLDOC)
|
||||
|
||||
get_extensions() {
|
||||
for section in "${sections[@]}"
|
||||
do
|
||||
echo $section
|
||||
readarray exts < <(key=$section yq e '.[env(key)] | .[]' $YAMLDOC)
|
||||
echo ${exts[@]}
|
||||
for ext in "${exts[@]}"
|
||||
do
|
||||
write_bat $ext
|
||||
write_sh $ext
|
||||
done
|
||||
done
|
||||
for section in "${sections[@]}"; do
|
||||
echo $section
|
||||
readarray exts < <(key=$section yq e '.[env(key)] | .[]' $YAMLDOC)
|
||||
echo ${exts[@]}
|
||||
for ext in "${exts[@]}"; do
|
||||
write_bat $ext
|
||||
write_sh $ext
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
write_bat() {
|
||||
echo "call code --install-extension $1 --force" >> install-extensions.bat
|
||||
echo "call code --install-extension $1 --force" >>install-extensions.bat
|
||||
}
|
||||
|
||||
write_sh() {
|
||||
echo "code --install-extension $1 --force" >> install-extensions.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
|
||||
echo >> install-extensions.bat
|
||||
echo "echo Installing VSCode extensions" >> install-extensions.bat
|
||||
echo "#!/usr/bin/env bash" > install-extensions.sh
|
||||
echo >> install-extensions.sh
|
||||
echo "echo Installing VSCode extensions" >> install-extensions.sh
|
||||
echo "echo off" >install-extensions.bat
|
||||
echo >>install-extensions.bat
|
||||
echo "echo Installing VSCode extensions" >>install-extensions.bat
|
||||
echo "#!/usr/bin/env bash" >install-extensions.sh
|
||||
echo >>install-extensions.sh
|
||||
echo "echo Installing VSCode extensions" >>install-extensions.sh
|
||||
|
||||
# read extensions and write install scripts
|
||||
get_extensions
|
||||
get_extensions
|
||||
|
|
Loading…
Reference in a new issue