aboutsummaryrefslogtreecommitdiffstats
path: root/testing/lab/allow-completion.patch
diff options
context:
space:
mode:
Diffstat (limited to 'testing/lab/allow-completion.patch')
-rw-r--r--testing/lab/allow-completion.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/testing/lab/allow-completion.patch b/testing/lab/allow-completion.patch
new file mode 100644
index 0000000000..cbfd6668ae
--- /dev/null
+++ b/testing/lab/allow-completion.patch
@@ -0,0 +1,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
++ }
++}
+