blob: cbfd6668ae59bb87c51ad45a7044514d02664ecc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
From c5d445472c183f6437966b2b1e9e68dab5926c24 Mon Sep 17 00:00:00 2001
From: Zaq? Wiedmann <zaquestion@gmail.com>
Date: Thu, 25 Jul 2019 12:37:49 -0700
Subject: [PATCH] #321: allow completions to be generated without
authenticating with GitLab
This makes it easy for distributors to provide completion out of the box in packaged versions of lab
---
main.go | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/main.go b/main.go
index 9a836b9..ba3f21c 100644
--- a/main.go
+++ b/main.go
@@ -127,6 +127,20 @@ func getUser(host, token string) string {
func main() {
log.SetFlags(log.LstdFlags | log.Lshortfile)
cmd.Version = version
- lab.Init(loadConfig())
+ if !skipInit() {
+ lab.Init(loadConfig())
+ }
cmd.Execute()
}
+
+func skipInit() bool {
+ if len(os.Args) <= 1 {
+ return false
+ }
+ switch os.Args[1] {
+ case "completion":
+ return true
+ default:
+ return false
+ }
+}
|