Skip to content

Commit 5dad051

Browse files
committed
kube-tmux: fix type name and error message
1 parent a092714 commit 5dad051

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
package main
66

77
import (
8-
"log"
8+
"fmt"
99
"os"
1010
"path/filepath"
1111
"text/template"
@@ -19,7 +19,7 @@ const (
1919
defaultformat = "{{.Context}}" + defaultSepalater + "{{.Namespace}}"
2020
)
2121

22-
type currentContext struct {
22+
type kubeContext struct {
2323
Context string
2424
Namespace string
2525
}
@@ -31,10 +31,10 @@ func main() {
3131

3232
config, err := kubeConfig.RawConfig()
3333
if err != nil {
34-
os.Exit(1)
34+
fmt.Fprintln(os.Stdout, "could not get kubeconfig")
3535
}
3636
if len(config.Contexts) == 0 {
37-
log.Fatal("empty context in kubeconfig")
37+
fmt.Fprintln(os.Stdout, "kubeconfig is empty context")
3838
}
3939

4040
curCtx := config.CurrentContext
@@ -48,9 +48,9 @@ func main() {
4848
format = os.Args[1]
4949
}
5050

51-
cctx := currentContext{
51+
kctx := kubeContext{
5252
Context: curCtx,
5353
Namespace: curNs,
5454
}
55-
template.Must(template.New("tmux").Parse(format)).Execute(os.Stdout, cctx)
55+
template.Must(template.New("kube-tmux").Parse(format)).Execute(os.Stdout, kctx)
5656
}

0 commit comments

Comments
 (0)