-
Notifications
You must be signed in to change notification settings - Fork 15
/
main.go
53 lines (47 loc) · 1.91 KB
/
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
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"github.com/c-bata/go-prompt"
"github.com/fenixsoft/fenix-cli/src/environments"
"github.com/fenixsoft/fenix-cli/src/environments/docker"
"github.com/fenixsoft/fenix-cli/src/environments/istio"
"github.com/fenixsoft/fenix-cli/src/environments/kubernetes"
_ "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"
"os"
)
func main() {
// init environment providers and select the active one
environments.Registers = map[environments.Environment]environments.Register{
environments.Docker: docker.RegisterEnv,
environments.Kubernetes: kubernetes.RegisterEnv,
environments.Istio: istio.RegisterEnv,
}
environments.Logo(nil, os.Stdout)
environments.Initialize()
environments.SelectCurrentEnvironment()
// start go-prompt as console
p := prompt.New(
environments.GetActiveExecutor(),
environments.GetActiveCompleter(),
// register hot key for select active env
prompt.OptionAddKeyBind(environments.BuildPromptKeyBinds()...),
// register live prefix that will be change automatically when env changed
prompt.OptionLivePrefix(environments.LivePrefix),
prompt.OptionTitle("Fenix-CLI: Interactive Cloud-Native Environment KubeClient"),
prompt.OptionInputTextColor(prompt.Yellow),
prompt.OptionCompletionOnDown(),
prompt.OptionMaxSuggestion(8),
prompt.OptionSuggestionTextColor(prompt.Black),
prompt.OptionDescriptionTextColor(prompt.Black),
prompt.OptionSuggestionBGColor(prompt.LightGray),
prompt.OptionDescriptionBGColor(prompt.DarkGray),
prompt.OptionSelectedSuggestionTextColor(prompt.White),
prompt.OptionSelectedDescriptionTextColor(prompt.White),
prompt.OptionSelectedSuggestionBGColor(prompt.Blue),
prompt.OptionSelectedDescriptionBGColor(prompt.DarkBlue),
prompt.OptionScrollbarBGColor(prompt.LightGray),
prompt.OptionScrollbarThumbColor(prompt.Blue),
)
p.Run()
}