From 3361f818855e0f15c0174343eb257d1fb3f4ef22 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Tue, 18 Jan 2022 12:29:42 -0600 Subject: [PATCH] shfmt formatting --- system/alias.sh | 7 ++--- system/conda.sh | 17 +++++------ system/custom.sh | 7 ++--- system/env.sh | 11 ++++--- system/function.sh | 73 +++++++++++++++++++++++----------------------- system/path.sh | 4 +-- 6 files changed, 57 insertions(+), 62 deletions(-) diff --git a/system/alias.sh b/system/alias.sh index e4b2239..94ce7e4 100644 --- a/system/alias.sh +++ b/system/alias.sh @@ -50,9 +50,8 @@ alias vivaldi="vivaldi-stable" #zellij if is-exectuable zellij; then - alias zs="zellij -s" - alias zl="zellij ls" - alias za="zellij a" + alias zs="zellij -s" + alias zl="zellij ls" + alias za="zellij a" fi ########################################## - diff --git a/system/conda.sh b/system/conda.sh index c74573b..c9a6559 100644 --- a/system/conda.sh +++ b/system/conda.sh @@ -2,22 +2,21 @@ # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! -__conda_setup="$('$HOME/mambaforge/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)" +__conda_setup="$('$HOME/mambaforge/bin/conda' 'shell.zsh' 'hook' 2>/dev/null)" if [ $? -eq 0 ]; then - eval "$__conda_setup" + eval "$__conda_setup" else - if [ -f "$HOME/mambaforge/etc/profile.d/conda.sh" ]; then - . "$HOME/mambaforge/etc/profile.d/conda.sh" - else - export PATH="$HOME/mambaforge/bin:$PATH" - fi + if [ -f "$HOME/mambaforge/etc/profile.d/conda.sh" ]; then + . "$HOME/mambaforge/etc/profile.d/conda.sh" + else + export PATH="$HOME/mambaforge/bin:$PATH" + fi fi unset __conda_setup if [ -f "$HOME/mambaforge/etc/profile.d/mamba.sh" ]; then - . "$HOME/mambaforge/etc/profile.d/mamba.sh" + . "$HOME/mambaforge/etc/profile.d/mamba.sh" fi # <<< conda initialize <<< [ -d "$HOME/mambaforge/envs/dev" ] && conda activate dev - diff --git a/system/custom.sh b/system/custom.sh index e90d36a..211b8d4 100644 --- a/system/custom.sh +++ b/system/custom.sh @@ -1,9 +1,8 @@ # env variables -if ! [ $(cat /etc/hostname)=="thinkpad" ];then - export BROWSER=/mnt/c/Users/daylin/AppData/Local/Vivaldi/Application/vivaldi.exe +if ! [ $(cat /etc/hostname)=="thinkpad" ]; then + export BROWSER=/mnt/c/Users/daylin/AppData/Local/Vivaldi/Application/vivaldi.exe else - export BROWSER=vivaldi-stable + export BROWSER=vivaldi-stable fi # aliases alias files=explorer.exe - diff --git a/system/env.sh b/system/env.sh index a13e983..aa29a84 100644 --- a/system/env.sh +++ b/system/env.sh @@ -4,8 +4,8 @@ export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}" export PATH=$PATH:~/bin -export HISTSIZE=32768; -export HISTFILESIZE="${HISTSIZE}"; +export HISTSIZE=32768 +export HISTFILESIZE="${HISTSIZE}" export SAVEHIST=4096 export HISTCONTROL=ignoredups:erasedups @@ -30,11 +30,10 @@ fi # setopt CORRECT # setopt CORRECT_ALL - # Setup fzf # --------- -if [[ ! "$PATH" == *$HOME/.fzf/bin* ]]; then - export PATH="${PATH:+${PATH}:}$HOME/.fzf/bin" +if [[ $PATH != *$HOME/.fzf/bin* ]]; then + export PATH="${PATH:+${PATH}:}$HOME/.fzf/bin" fi if is-executable fzf; then @@ -54,7 +53,7 @@ fi #[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm #[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion if is-executable fnm; then - eval "$(fnm env)" + eval "$(fnm env)" fi # enhancd diff --git a/system/function.sh b/system/function.sh index 13e02f3..1dba76b 100644 --- a/system/function.sh +++ b/system/function.sh @@ -1,58 +1,58 @@ function cl() { - DIR="$*"; - # if no DIR given, go home - if [ $# -lt 1 ]; then - DIR=$HOME; - fi; - builtin cd "${DIR}" && \ - # use your preferred ls command - ls -F --color=auto + DIR="$*" + # if no DIR given, go home + if [ $# -lt 1 ]; then + DIR=$HOME + fi + builtin cd "${DIR}" && + # use your preferred ls command + ls -F --color=auto } prepend-path() { - [ -d $1 ] && PATH="$1:$PATH" + [ -d $1 ] && PATH="$1:$PATH" } #delete and reclone remote repo -reclone () { - basename=${PWD##*/} - remoteurl=$(git remote get-url --push origin) - cd .. - echo $basename - echo $remoteurl - rm -rf $basename - git clone $remoteurl - cd $basename +reclone() { + basename=${PWD##*/} + remoteurl=$(git remote get-url --push origin) + cd .. + echo $basename + echo $remoteurl + rm -rf $basename + git clone $remoteurl + cd $basename } # snakemake use all cores by default sm() { - if [[ "$*" == *"-j"* || "$*" == *"--jobs"* || "$*" == *"--cores"* ]]; then - snakemake $@ - else - snakemake -j all $@ - fi + if [[ $* == *"-j"* || $* == *"--jobs"* || $* == *"--cores"* ]]; then + snakemake $@ + else + snakemake -j all $@ + fi } function gi() { - curl -sL "https://www.toptal.com/developers/gitignore/api/$@" ; - } - - -# make pdfs or svgs from vegalite json's -mkvegapdf () { - vl2vg $1 | vg2pdf > $2 + curl -sL "https://www.toptal.com/developers/gitignore/api/$@" } -mkvegasvg () { - vl2vg $1 | vg2svg > $2 +# make pdfs or svgs from vegalite json's +mkvegapdf() { + vl2vg $1 | vg2pdf >$2 +} + +mkvegasvg() { + vl2vg $1 | vg2svg >$2 } # quick and dirty pdf generation from simple md -md2pdf () { +md2pdf() { root=$1 # get extension and root path: https://stackoverflow.com/a/40928328 - fname="${root#.}";fname="${root%"$fname"}${fname%.*}" + fname="${root#.}" + fname="${root%"$fname"}${fname%.*}" ext="${root#"$fname"}" echo "converting $root to pdf" @@ -66,7 +66,7 @@ md2pdf () { } -py2nb2html () { +py2nb2html() { if [ $# -eq 0 ]; then echo "No arguments provided" return 1 @@ -77,8 +77,7 @@ py2nb2html () { jupytext --to notebook -o - $pyfile | jupyter nbconvert --execute --to html --stdin $@ } -web () { +web() { filepath=$(wslpath -w $1) $BROWSER $filepath } - diff --git a/system/path.sh b/system/path.sh index a6a8097..dce629f 100644 --- a/system/path.sh +++ b/system/path.sh @@ -26,8 +26,8 @@ PATH="$HOME/go/bin:$PATH" # PATH="$(perl -e 'print join(":", grep { not $seen{$_}++ } split(/:/, $ENV{PATH}))')" # printf %s "$PATH" | awk -v RS=: -v ORS=: '!arr[$0]++' -PATH=$(printf %s "$PATH" \ - | awk -vRS=: -vORS= '!a[$0]++ {if (NR>1) printf(":"); printf("%s", $0) }' ) +PATH=$(printf %s "$PATH" | + awk -vRS=: -vORS= '!a[$0]++ {if (NR>1) printf(":"); printf("%s", $0) }') # Wrap up export PATH