forked from anoop2811/kube-prompt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (36 loc) · 984 Bytes
/
main.go
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
39
40
41
42
package main
import (
"fmt"
"os"
prompt "github.com/c-bata/go-prompt"
"github.com/c-bata/go-prompt/completer"
"github.com/guidewire/kube-prompt/internal/debug"
"github.com/guidewire/kube-prompt/kube"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
_ "k8s.io/client-go/plugin/pkg/client/auth/oidc"
_ "k8s.io/client-go/plugin/pkg/client/auth/openstack"
)
var (
version string
revision string
)
func main() {
c, err := kube.NewCompleter("")
if err != nil {
fmt.Println("error", err)
os.Exit(1)
}
defer debug.Teardown()
fmt.Printf("kube-prompt %s (rev-%s)\n", version, revision)
fmt.Println("Please use `exit` or `Ctrl-D` to exit this program.")
defer fmt.Println("Bye!")
p := prompt.New(
kube.Executor,
c.Complete,
prompt.OptionTitle("kube-prompt: interactive kubernetes client"),
prompt.OptionPrefix(">>> "),
prompt.OptionInputTextColor(prompt.Yellow),
prompt.OptionCompletionWordSeparator(completer.FilePathCompletionSeparator),
)
p.Run()
}