From: Oleg Broytman Date: Mon, 5 Aug 2019 16:18:42 +0000 (+0300) Subject: .shellrc: Report error if no directory found for the argument X-Git-Url: https://git.phdru.name/?p=dotfiles.git;a=commitdiff_plain;h=bb774a1a3b907df994f1e473e6a5e0dd3daf4c86 .shellrc: Report error if no directory found for the argument --- diff --git a/.shellrc b/.shellrc index 112fa44..2162d3b 100644 --- a/.shellrc +++ b/.shellrc @@ -225,6 +225,12 @@ if test -x /usr/bin/git >/dev/null 2>&1; then cdgitpath remote.$remote.url else + if [ -n "$1" ]; then + echo "Cannot find directory for remote $1" >&2 + echo "Usage: cdremote [remote_name]" >&2 + return 1 + fi + _list_remotes '^\(/\|\.\./\)' # (/ or ../ at the beginning) if [ ${#GIT_REMOTES[*]} -eq 1 ]; then remote=${GIT_REMOTES[0]}