]> git.phdru.name Git - dotfiles.git/commitdiff
.shellrc: Report error if no directory found for the argument
authorOleg Broytman <phd@phdru.name>
Mon, 5 Aug 2019 16:18:42 +0000 (19:18 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 5 Aug 2019 16:18:42 +0000 (19:18 +0300)
.shellrc

index 112fa4422eb59ef2c2c7f4d1358bf4aa66c7b382..2162d3b5164c77f7f430b824437a5dd3a31774b9 100644 (file)
--- 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]}