Bugfix: $2 is the name and $3 may be a path

This commit is contained in:
Reid 'arrdem' McKenzie 2022-11-26 12:08:34 -07:00
parent d3c40428d7
commit 3bd6d3b678

4
label
View file

@ -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)