-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
67 lines (61 loc) · 1.34 KB
/
main.go
File metadata and controls
67 lines (61 loc) · 1.34 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package main
import (
"context"
_ "embed"
"fmt"
"log"
"os"
"github.com/earthboundkid/versioninfo/v2"
"github.com/talss89/kx/internal/cmd"
"github.com/urfave/cli/v3"
)
func main() {
command := &cli.Command{
Commands: []*cli.Command{
{
Name: "prompt",
Usage: "",
Action: cmd.PromptAction,
Hidden: true,
},
{
Name: "checktime",
Usage: "",
Action: cmd.CheckTimeAction,
Hidden: true,
},
{
Name: "version",
Usage: "Print the version number",
Aliases: []string{"v"},
Action: func(_ context.Context, cmd *cli.Command) error {
fmt.Println("kx - Switch to a different Kubernetes context for a specific duration")
fmt.Println("")
fmt.Println("🌐 https://github.com/talss89/kx")
fmt.Println("🚀 ", versioninfo.Version)
return nil
},
},
},
Name: "kx",
Usage: "Switch to a different Kubernetes context for a specific duration",
UsageText: "kx [duration]",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "shell",
Value: "",
Usage: "Shell to invoke",
},
&cli.StringFlag{
Name: "context",
Aliases: []string{"ctx"},
Value: "",
Usage: "Kubernetes context to switch to",
},
},
Action: cmd.SwitchAction,
}
if err := command.Run(context.Background(), os.Args); err != nil {
log.Fatal(err)
}
}