mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-07-21 02:05:16 +03:00
38 lines
927 B
Diff
38 lines
927 B
Diff
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
|
|
+ }
|
|
+}
|
|
|