From a8c315f5b43ce9e71bfa475b25e24c067e02924e Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Wed, 10 Jul 2024 21:18:59 -0600 Subject: [PATCH] Bash: update magick wrapper --- bash/.bash_functions | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/bash/.bash_functions b/bash/.bash_functions index a34e3f3..a945105 100644 --- a/bash/.bash_functions +++ b/bash/.bash_functions @@ -298,13 +298,13 @@ function ta() { # Image magick ====================================================== function magika() { if [[ "$1" == "a" || "$1" == "av1" ]]; then - magick convert "$2" "${2%.*}.avif" + magick "$2" "${2%.*}.avif" elif [[ "$1" == "i" ]]; then shift magick identify "$@" elif [[ "$1" == "c" ]]; then shift - magick convert "$@" + magick "$@" else magick "$@" fi @@ -337,5 +337,21 @@ function truecolor () { source ~/.bash_prompt } +# Navigate to the project root ====================================== +rooter() { + local current_dir="$PWD" + + while [[ "$current_dir" != "/" ]]; do + if [[ -d "$current_dir/.git" ]]; then + cd "$current_dir" + return 0 + else + current_dir="$(dirname "$current_dir")" + fi + done + + echo "No .git directory found above cwd." >&2 + return 1 +} # vim: set ft=bash ff=unix: