From 3bd6d3b67882ced172c36fcd7cc9f2a502252ba0 Mon Sep 17 00:00:00 2001 From: Reid 'arrdem' McKenzie Date: Sat, 26 Nov 2022 12:08:34 -0700 Subject: [PATCH] Bugfix: $2 is the name and $3 may be a path --- label | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/label b/label index 7f57df8..cb15496 100755 --- a/label +++ b/label @@ -1,6 +1,6 @@ #!/usr/bin/env zsh -set -ex +set -e : "${1:=--help}" @@ -19,7 +19,7 @@ EOF label rm "$2" _zsh_goto_sed -i '/^$/d' "$(_goto_file)" # Remove empty lines _zsh_goto_sed -i -e '$a\' "$(_goto_file)" # Fix potentially missing last newline - printf '%s %s\n' "${1}" $(echo "$2" | _zsh_goto_sed "s^${HOME}^~^g") >> "$(_goto_file)" + printf '%s %s\n' "${2}" $(realpath "${3:-$PWD}" | _zsh_goto_sed "s^${HOME}^~^g") >> "$(_goto_file)" ;; get)