nix-prefetch-git: Display usage message if missing builder arguments are

missing.

svn path=/nixpkgs/trunk/; revision=29076
This commit is contained in:
Nicolas Pierron 2011-09-07 10:02:14 +00:00
parent 5f5a47fc76
commit 0608f1a9b5

View File

@ -55,9 +55,24 @@ for arg; do
fi fi
done done
if test -z "$url"; then usage(){
echo "syntax: nix-prefetch-git URL [REVISION [EXPECTED-HASH]]" >&2 echo >&2 "syntax: nix-prefetch-git [options] [URL [REVISION [EXPECTED-HASH]]]
Options:
--out path Path where the output would be stored.
--url url Any url understand by 'git clone'.
--rev ref Any sha1 or references (such as refs/heads/master)
--hash h Expected hash.
--deepClone Clone submodules recursively.
--no-deepClone Do not clone submodules.
--leave-dotGit Keep the .git directories.
--builder Clone as fetchgit does, but url, rev, and out option are mandatory.
"
exit 1 exit 1
}
if test -z "$url"; then
usage
fi fi
@ -200,6 +215,7 @@ clone_user_rev() {
} }
if test -n "$builder"; then if test -n "$builder"; then
test -n "$out" -a -n "$url" -a -n "$rev" || usage
mkdir $out mkdir $out
clone_user_rev "$out" "$url" "$rev" clone_user_rev "$out" "$url" "$rev"
else else