-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
52 lines (42 loc) · 1.59 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
package main
import (
"github.com/argyle-engineering/ksops/v2/pkg"
"github.com/spf13/cobra"
"os"
"sigs.k8s.io/kustomize/kyaml/errors"
"sigs.k8s.io/kustomize/kyaml/fn/framework"
"sigs.k8s.io/kustomize/kyaml/kio"
)
func main() {
rootCmd.SetVersionTemplate("{{.Version}}\n")
err := rootCmd.Execute()
if err != nil {
os.Exit(1)
}
}
var version string
// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "ksops",
Short: "KSOPS is a flexible Kustomize KRM-based plugin for SOPS encrypted resources",
Long: `KSOPS is a flexible Kustomize KRM-based plugin for SOPS encrypted resources.
- Provides the ability to fail silently if the generator fails to decrypt files.
- Generates dummy secrets with the 'KSOPS_GENERATE_DUMMY_SECRETS' environment variable.`,
RunE: func(cmd *cobra.Command, args []string) error {
// No config is required
p := framework.SimpleProcessor{Config: nil, Filter: kio.FilterFunc(pkg.Ksops)}
// STDIN and STDOUT will be used if no reader or writer respectively is provided.
err := framework.Execute(p, nil)
return errors.Wrap(err)
},
Version: version,
}
func init() {
// Here you will define your flags and configuration settings.
// Cobra supports persistent flags, which, if defined here,
// will be global for your application.
// rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (default is $HOME/.ksops.yaml)")
// Cobra also supports local flags, which will only run
// when this action is called directly.
//rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}