Skip to content

Commit

Permalink
refactor: reduce variable use
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Larson <[email protected]>
  • Loading branch information
LucasLarson committed May 31, 2024
1 parent 2700f40 commit 8d8b27b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions custom/aliases.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,19 @@ alias ....='cd -- ../../..'
alias .....='cd -- ../../../..'

cdp() {
cd_from="$(command pwd -L)"
cd_to="$(command pwd -P)"
if test "${cd_from-}" != "${cd_to-}"; then
printf -- 'moving from \342\200\230%s\342\200\231\n' "${cd_from-}"
if test "${PWD-}" != "${cd_to-}"; then
printf -- 'moving from \342\200\230%s\342\200\231\n' "${PWD-}"
cd -- "${cd_to-}" || {
printf -- 'unable to perform this operation\n'
return 1
}
printf -- ' into \342\200\230%s\342\200\231\n' "${cd_to-}"
else
printf -- 'already in unaliased directory '
printf -- '\342\200\230%s\342\200\231\n' "${cd_from-}"
printf -- '\342\200\230%s\342\200\231\n' "${PWD-}"
return 1
fi
unset -v -- cd_from
unset -v -- cd_to
}

Expand Down

0 comments on commit 8d8b27b

Please sign in to comment.