-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.go
More file actions
35 lines (27 loc) · 719 Bytes
/
main.go
File metadata and controls
35 lines (27 loc) · 719 Bytes
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
// Package main is the entrypoint of the application
package main
import (
"fmt"
"os"
"github.com/cloudnative-pg/machinery/pkg/log"
"github.com/spf13/cobra"
"github.com/leonardoce/cnpg-i-skip-initdb/cmd/plugin"
)
func main() {
cobra.EnableTraverseRunHooks = true
logFlags := &log.Flags{}
rootCmd := &cobra.Command{
Use: "cnpg-i-skip-initdb",
Short: "A plugin example",
PersistentPreRun: func(cmd *cobra.Command, _ []string) {
logFlags.ConfigureLogging()
cmd.SetContext(log.IntoContext(cmd.Context(), log.GetLogger()))
},
}
logFlags.AddFlags(rootCmd.PersistentFlags())
rootCmd.AddCommand(plugin.NewCmd())
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}