diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..02719bf --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +.PHONY: lint +lint: + shfmt -s -w $(shell shfmt -f .) diff --git a/bin/install-pkgs b/bin/install-pkgs index 43cd671..55a50a2 100755 --- a/bin/install-pkgs +++ b/bin/install-pkgs @@ -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" diff --git a/bin/is-executable b/bin/is-executable index 31e2fa1..7d35356 100755 --- a/bin/is-executable +++ b/bin/is-executable @@ -1,7 +1,7 @@ #!/usr/bin/env bash if [ -x "$(command -v $1)" ]; then - exit 0 + exit 0 else - exit 1 + exit 1 fi diff --git a/bin/is-tty b/bin/is-tty index 6c1d2ba..24bbb84 100755 --- a/bin/is-tty +++ b/bin/is-tty @@ -1,8 +1,9 @@ #!/bin/sh case $(tty) in /dev/tty[0-9]*) - exit 0;; - *) - exit 1;; + exit 0 + ;; +*) + exit 1 + ;; esac - diff --git a/extras.sh b/extras.sh index 9bf8a05..7c56240 100755 --- a/extras.sh +++ b/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 <&1 | bathelp + "$@" --help 2>&1 | bathelp } diff --git a/vscode/generate_install_scripts.sh b/vscode/generate_install_scripts.sh index fb9015b..8ace32a 100755 --- a/vscode/generate_install_scripts.sh +++ b/vscode/generate_install_scripts.sh @@ -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 \ No newline at end of file +get_extensions