From: Linus Torvalds Date: Tue, 14 Jun 2005 18:01:49 +0000 (-0700) Subject: Make 'git' script be a bit more helpful on unrecognized commands X-Git-Tag: v0.99~265 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=fc865468d88d45e76e21a9db2445a4b970f7423b;p=git.git Make 'git' script be a bit more helpful on unrecognized commands --- diff --git a/git b/git index c201c60a..9f511956 100755 --- a/git +++ b/git @@ -1,4 +1,19 @@ #!/bin/sh -cmd="git-$1-script" +cmd="$1" shift -exec $cmd "$@" +if which git-$cmd-script >& /dev/null +then + exec git-$cmd-script "$@" +fi + +if which git-$cmd >& /dev/null +then + exec git-$cmd "$@" +fi + +alternatives=($(echo $PATH | tr ':' '\n' | while read i; do ls $i/git-*-script 2> /dev/null; done)) + +echo Git command "'$cmd'" not found. Try one of +for i in "${alternatives[@]}"; do + echo $i | sed 's:^.*/git-: :' | sed 's:-script$::' +done | sort | uniq