aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2024-01-02 17:31:13 +0100
committerLibravatar Rutger Broekhoff2024-01-02 17:31:13 +0100
commit3d315c0de053fa131724fa754cdfe004f95c62ce (patch)
treee9c08ad931af6cebc27e1eda59b14b4dd05a6bac /cmd
parent61c9f257bb9a6e22f46e234762f68a3d30c86ae7 (diff)
downloadgitolfs3-3d315c0de053fa131724fa754cdfe004f95c62ce.tar.gz
gitolfs3-3d315c0de053fa131724fa754cdfe004f95c62ce.zip
Print usage in git-lfs-authenticate
Diffstat (limited to 'cmd')
-rw-r--r--cmd/git-lfs-authenticate/main.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/cmd/git-lfs-authenticate/main.go b/cmd/git-lfs-authenticate/main.go
index dd39606..5a5b760 100644
--- a/cmd/git-lfs-authenticate/main.go
+++ b/cmd/git-lfs-authenticate/main.go
@@ -106,6 +106,8 @@ func wipe(b []byte) {
106 } 106 }
107} 107}
108 108
109const usage = "Usage: git-lfs-authenticate <REPO> <OPERATION (upload/download)>"
110
109func main() { 111func main() {
110 // Even though not explicitly described in the Git LFS documentation, the 112 // Even though not explicitly described in the Git LFS documentation, the
111 // git-lfs-authenticate command is expected to either exit succesfully with 113 // git-lfs-authenticate command is expected to either exit succesfully with
@@ -118,13 +120,13 @@ func main() {
118 logger := newLogger(reqID) 120 logger := newLogger(reqID)
119 121
120 if len(os.Args) != 3 { 122 if len(os.Args) != 3 {
121 die("expected 2 arguments (path, operation), got %d", len(os.Args)-1) 123 die(usage)
122 } 124 }
123 125
124 repo := strings.TrimPrefix(strings.TrimSuffix(os.Args[1], ".git"), "/") 126 repo := strings.TrimPrefix(strings.TrimSuffix(os.Args[1], ".git"), "/")
125 operation := os.Args[2] 127 operation := os.Args[2]
126 if operation != "download" && operation != "upload" { 128 if operation != "download" && operation != "upload" {
127 die("expected operation to be upload or download, got %s", operation) 129 die(usage)
128 } 130 }
129 131
130 repoHRefBaseStr := os.Getenv("REPO_HREF_BASE") 132 repoHRefBaseStr := os.Getenv("REPO_HREF_BASE")