From 5f5f79d270278118da990ef6794ba5b49af01ac0 Mon Sep 17 00:00:00 2001 From: Ismo Vuorinen Date: Thu, 13 Apr 2023 22:23:22 +0300 Subject: [PATCH] misc: dfm tweaks, documentation, code style --- .yamlfmt | 1 - config/alias | 13 +++++++++---- config/exports | 1 - config/functions | 7 ++++++- local/bin/dfm | 22 +++++++++++++++------- 5 files changed, 30 insertions(+), 14 deletions(-) diff --git a/.yamlfmt b/.yamlfmt index 3f0ae5a..fb70677 100644 --- a/.yamlfmt +++ b/.yamlfmt @@ -22,4 +22,3 @@ exclude: - ./dotbot-*/** - ./config/astronvim/** - ./config/nvim/** - diff --git a/config/alias b/config/alias index 4a26596..46b3f14 100755 --- a/config/alias +++ b/config/alias @@ -52,11 +52,16 @@ if [[ $(uname) == 'Darwin' ]]; then alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl" fi -alias watchx='watch -dpbc' # watch with: differences, precise, beep and color +# watch with: differences, precise, beep and color +alias watchx='watch -dpbc' +# delete .DS_Store files alias zapds='find . -name ".DS_Store" -print -delete' -alias t='tail -f' # tail with follow flag on -alias dn='du -chd1' # directory usage, return only the total -alias mirrorsite='wget -m -k -K -E -e robots=off' # Mirror site +# tail with follow flag on +alias t='tail -f' +# directory usage, return only the total +alias dn='du -chd1' +# Mirror site with wget +alias mirror_site='wget -m -k -K -E -e robots=off' # Mirror stdout to stderr, useful for seeing data going through a pipe alias peek='tee >(cat 1>&2)' diff --git a/config/exports b/config/exports index 220c7f4..c486de9 100755 --- a/config/exports +++ b/config/exports @@ -41,4 +41,3 @@ source "$DOTFILES/config/exports-apps" if command -v nvim &> /dev/null; then export EDITOR="nvim" fi - diff --git a/config/functions b/config/functions index 113e444..1f14c1b 100755 --- a/config/functions +++ b/config/functions @@ -66,17 +66,23 @@ function silent "$@" >&/dev/null } +# Remove directory from the PATH variable +# usage: path_remove ~/.local/bin function path_remove { PATH=$(echo -n "$PATH" | awk -v RS=: -v ORS=: "\$0 != \"$1\"" | sed 's/:$//') } +# Append directory to the PATH +# usage: path_append ~/.local/bin function path_append { path_remove "$1" PATH="${PATH:+"$PATH:"}$1" } +# Prepend directory to the PATH +# usage: path_prepend ~/.local/bin function path_prepend { path_remove "$1" @@ -108,4 +114,3 @@ function x-default-antigen-bundles hash python 2> /dev/null && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv hash rvm 2> /dev/null && antigen bundle unixorn/rvm-plugin } - diff --git a/local/bin/dfm b/local/bin/dfm index b2d3a85..ee8d798 100755 --- a/local/bin/dfm +++ b/local/bin/dfm @@ -15,6 +15,8 @@ SCRIPT=$(basename "$0") +VERSION_NVM="v0.39.3" + # shellcheck source=./../../scripts/shared.sh source "$DOTFILES/scripts/shared.sh" @@ -29,8 +31,9 @@ function section_install $0 install starship $0 brew install $0 install composer - $0 install dotenv-linter + $0 install dotenv $0 install gh + $0 install go $0 install imagick $0 install nvm $0 install npm @@ -45,7 +48,7 @@ function section_install bash "$DOTFILES/scripts/install-composer.sh" \ && msg_done "🎉 composer installed!" ;; - dotenv-linter) + dotenv) curl -sSfL \ https://raw.githubusercontent.com/dotenv-linter/dotenv-linter/master/install.sh \ | sh -s -- -b "$XDG_BIN_HOME" \ @@ -55,6 +58,10 @@ function section_install bash "$DOTFILES/scripts/install-gh-extensions.sh" \ && msg_done "🎉 github cli extensions installed!" ;; + go) + bash "$DOTFILES/scripts/install-go-packages.sh" \ + && msg_done "🎉 go packages installed!" + ;; imagick) wget https://imagemagick.org/archive/binaries/magick > "$XDG_BIN_HOME/magick" \ && msg_done "🎉 imagick installed!" @@ -68,9 +75,9 @@ function section_install && msg_done "🎉 Brewfile defined apps has been installed!" ;; nvm) - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash \ - && git checkout "$HOME/.zshrc" \ + curl -o- "https://raw.githubusercontent.com/nvm-sh/nvm/$VERSION_NVM/install.sh" | bash \ && nvm install --lts --latest-npm --default \ + && git checkout "$HOME/.zshrc" \ && msg_done "🎉 nvm installed!" ;; npm) @@ -83,15 +90,16 @@ function section_install ;; z) bash "$DOTFILES/scripts/install-z.sh" \ - && msg_done "🎉 Z has been installed!" + && msg_done "🎉 z has been installed!" ;; *) - menu_section "$USAGE_PREFIX" "all | antigen | composer | dotenv-linter | imagick | starship | macos | nvm | npm" + menu_section "$USAGE_PREFIX" "all | antigen | composer | dotenv | gh | go | imagick | starship | macos | nvm | npm" menu_item "all" "Installs macos defaults, antigen, starship, brew, nvm, npm packages and others" menu_item "antigen" "Updates the antigen.zsh file" menu_item "composer" "Install composer" - menu_item "dotenv-linter" "Install dotenv-linter" + menu_item "dotenv" "Install dotenv-linter" menu_item "gh" "Install GitHub CLI Extensions" + menu_item "go" "Install Go Packages" menu_item "imagick" "Install ImageMagick CLI" menu_item "starship" "Install starship.rs" menu_item "macos" "Setup nice macOS defaults"