summary refs log tree commit diff
path: root/pkgs/build-support/fetchgit/nix-prefetch-git
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2016-01-19 12:01:55 +0100
committerDomen Kožar <domen@dev.si>2016-01-19 12:01:55 +0100
commit9c571a98ed1eac45c0d7e5df2e12145d39a07b87 (patch)
tree2fd796135c9e5d414e5112dc48b207dc96623acb /pkgs/build-support/fetchgit/nix-prefetch-git
parent44d0d58c843cede9b6a4e1114a0ab8029fba87b7 (diff)
parent42ff8ad780522111fd597f94ee40beae5aeb6ac3 (diff)
downloadnixpkgs-9c571a98ed1eac45c0d7e5df2e12145d39a07b87.tar
nixpkgs-9c571a98ed1eac45c0d7e5df2e12145d39a07b87.tar.gz
nixpkgs-9c571a98ed1eac45c0d7e5df2e12145d39a07b87.tar.bz2
nixpkgs-9c571a98ed1eac45c0d7e5df2e12145d39a07b87.tar.lz
nixpkgs-9c571a98ed1eac45c0d7e5df2e12145d39a07b87.tar.xz
nixpkgs-9c571a98ed1eac45c0d7e5df2e12145d39a07b87.tar.zst
nixpkgs-9c571a98ed1eac45c0d7e5df2e12145d39a07b87.zip
Merge pull request #10998 from andrewrynhard/master
Add help flag to nix-prefetch-git
Diffstat (limited to 'pkgs/build-support/fetchgit/nix-prefetch-git')
-rwxr-xr-xpkgs/build-support/fetchgit/nix-prefetch-git34
1 files changed, 17 insertions, 17 deletions
diff --git a/pkgs/build-support/fetchgit/nix-prefetch-git b/pkgs/build-support/fetchgit/nix-prefetch-git
index fbefba5ccc0..6cf694dd2b1 100755
--- a/pkgs/build-support/fetchgit/nix-prefetch-git
+++ b/pkgs/build-support/fetchgit/nix-prefetch-git
@@ -24,6 +24,22 @@ else
     leaveDotGit=true
 fi
 
+usage(){
+    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.
+      --fetch-submodules Fetch submodules.
+      --builder       Clone as fetchgit does, but url, rev, and out option are mandatory.
+"
+    exit 1
+}
 
 argi=0
 argfun=""
@@ -40,6 +56,7 @@ for arg; do
             --leave-dotGit) leaveDotGit=true;;
             --fetch-submodules) fetchSubmodules=true;;
             --builder) builder=true;;
+            --help) usage; exit;;
             *)
                 argi=$(($argi + 1))
                 case $argi in
@@ -61,23 +78,6 @@ for arg; do
     fi
 done
 
-usage(){
-    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.
-      --fetch-submodules Fetch submodules.
-      --builder       Clone as fetchgit does, but url, rev, and out option are mandatory.
-"
-    exit 1
-}
-
 if test -z "$url"; then
     usage
 fi