Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
shfm: Fix cd when dir starts with -
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanaraps committed Aug 11, 2020
1 parent fa04365 commit 0868399
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions shfm
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ main() {
;;

l?|C2|"$esc") # ARROW RIGHT
if [ -d "$cur" ] && cd "$cur" >/dev/null 2>&1; then
if [ -d "$cur" ] && cd -- "$cur" >/dev/null 2>&1; then
set -- *
y=1 y2=1 cur=$1 ltype=
redraw "$@"
Expand Down Expand Up @@ -349,15 +349,15 @@ main() {
'~/'*) ans=$HOME/${ans#"~/"}
esac

cd "${ans:="$0"}" >/dev/null 2>&1|| continue
cd -- "${ans:="$0"}" >/dev/null 2>&1|| continue
set -- *
y=1 y2=1 cur=$1
redraw "$@"
;;

/?)
prompt / r
set -- "$ans"*
set -- $ans*

case $1$# in
"$ans*1") set -- 'no results'
Expand All @@ -369,7 +369,7 @@ main() {
;;

-?)
cd "$OLDPWD" >/dev/null 2>&1|| continue
cd -- "$OLDPWD" >/dev/null 2>&1|| continue
set -- *
y=1 y2=1 cur=$1
redraw "$@"
Expand Down

0 comments on commit 0868399

Please sign in to comment.