From d482da9dc6d63e4d84fec7b872fdd346a3682a5e Mon Sep 17 00:00:00 2001 From: Smith Pereira Date: Tue, 3 Feb 2026 13:58:20 +0000 Subject: [PATCH] Improve portability and fix minor bugs - Remove hardcoded user email/name from gitconfig for portability - Fix perl regex in GPG key extraction (use $& to print match) - Make cargo env loading conditional to prevent errors when not installed - Simplify link.sh extract_and_link function and fix variable quoting Co-Authored-By: Claude Opus 4.5 --- modules/git/gitconfig | 2 -- modules/git/setup.github.sh | 2 +- modules/zsh/zshenv | 2 +- scripts/link.sh | 16 +++++----------- 4 files changed, 7 insertions(+), 15 deletions(-) diff --git a/modules/git/gitconfig b/modules/git/gitconfig index f95ca34..bfeb6fe 100644 --- a/modules/git/gitconfig +++ b/modules/git/gitconfig @@ -235,8 +235,6 @@ # https://github.com/git/git/blob/90f7b16b3adc78d4bbabbd426fb69aa78c714f71/Documentation/config.txt#L2847-L2855 useConfigOnly = true - email = daniel@hails.info - name = Daniel Hails # [!] DO NOT store sensitive information such as the Git user # credentials (`name` / `email`), or things such as the `signingkey` diff --git a/modules/git/setup.github.sh b/modules/git/setup.github.sh index ae2a682..c3fe44d 100644 --- a/modules/git/setup.github.sh +++ b/modules/git/setup.github.sh @@ -88,7 +88,7 @@ github::get_gpg_key_id() { gpgKeyId="$(gpg --list-secret-keys --keyid-format LONG \ | grep git-auto -B 2 \ | grep sec \ - | perl -nle 'print && while m{(?<=/)[A-Z0-9]{16}}g')" + | perl -nle 'print $& while m{(?<=/)[A-Z0-9]{16}}g')" } github::set_gpg_key() { diff --git a/modules/zsh/zshenv b/modules/zsh/zshenv index 4c1c5f9..50fc000 100644 --- a/modules/zsh/zshenv +++ b/modules/zsh/zshenv @@ -7,4 +7,4 @@ for i in ${fpath[@]}; do fi done -. "$HOME/.cargo/env" +[[ -f "$HOME/.cargo/env" ]] && . "$HOME/.cargo/env" diff --git a/scripts/link.sh b/scripts/link.sh index 8624c8c..40f61c7 100644 --- a/scripts/link.sh +++ b/scripts/link.sh @@ -69,17 +69,11 @@ link::file () { } link::extract_and_link() { - declare -A links local sep=' -> ' - while read line + while read -r line || [[ -n "$line" ]] do - src=${line%%$sep*} - dst=${line#*$sep} - links[$src]=$dst - done < $1 - - for src in ${!links[*]} - do - link::file "$(dirname $1)/$src" "${links[$src]/#\~/$HOME}" - done + local src=${line%%$sep*} + local dst=${line#*$sep} + link::file "$(dirname "$1")/$src" "${dst/#\~/$HOME}" + done < "$1" }