Skip to content

Commit

Permalink
Check only format is set
Browse files Browse the repository at this point in the history
  • Loading branch information
babarot committed Apr 2, 2023
1 parent b5e031f commit d2cef78
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion functions/enhancd.fish
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function enhancd
echo "$opt: 'func' label is required" >&2
return 1
end
if not string match --quiet '*%*' $format
if test -n $format; and not string match --quiet '*%*' $format
echo "$opt: 'format' label needs to include '%' (selected line)" >&2
return 1
fi
Expand Down
2 changes: 1 addition & 1 deletion src/cd.sh
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ __enhancd::cd()
echo "${opt}: 'func' label is required" >&2
return 1
fi
if [[ ${format//\%/} == ${format} ]]; then
if [[ -n ${format} ]] && [[ ${format//\%/} == "${format}" ]]; then
echo "${opt}: 'format' label needs to include '%' (selected line)" >&2
return 1
fi
Expand Down

0 comments on commit d2cef78

Please sign in to comment.