-
Notifications
You must be signed in to change notification settings - Fork 197
/
main.go
42 lines (37 loc) · 1.06 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
package main
import (
"fmt"
"io"
"os"
"get.porter.sh/porter/pkg/kubernetes"
"github.com/spf13/cobra"
)
func main() {
cmd := buildRootCommand(os.Stdin)
if err := cmd.Execute(); err != nil {
fmt.Printf("err: %s\n", err)
os.Exit(1)
}
}
func buildRootCommand(in io.Reader) *cobra.Command {
mixin := kubernetes.New()
mixin.In = in
cmd := &cobra.Command{
Use: "kubernetes",
Long: "kubernetes is a porter 👩🏽✈️ mixin that you can you can use to apply kubernetes manifests in your bundle",
PersistentPreRun: func(cmd *cobra.Command, args []string) {
mixin.Out = cmd.OutOrStdout()
mixin.Err = cmd.OutOrStderr()
},
SilenceUsage: true,
}
cmd.PersistentFlags().BoolVar(&mixin.Debug, "debug", false, "Enable debug logging")
cmd.AddCommand(buildVersionCommand(mixin))
cmd.AddCommand(buildBuildCommand(mixin))
cmd.AddCommand(buildInstallCommand(mixin))
cmd.AddCommand(buildInvokeCommand(mixin))
cmd.AddCommand(buildUpgradeCommand(mixin))
cmd.AddCommand(buildUninstallCommand(mixin))
cmd.AddCommand(buildSchemaCommand(mixin))
return cmd
}