forked from joselitofilho/aws-terraform-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
s3.go
39 lines (31 loc) · 898 Bytes
/
s3.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
package cmd
import (
"github.com/spf13/cobra"
"github.com/joselitofilho/aws-terraform-generator/internal/generators/s3"
)
// s3Cmd represents the sqs command.
var s3Cmd = &cobra.Command{
Use: "s3",
Short: "Manage S3",
Run: func(cmd *cobra.Command, _ []string) {
config, err := cmd.Flags().GetString(flagConfig)
if err != nil {
printErrorAndExit(err)
}
output, err := cmd.Flags().GetString(flagOutput)
if err != nil {
printErrorAndExit(err)
}
err = s3.NewS3(config, output).Build()
if err != nil {
printErrorAndExit(err)
}
},
}
func init() {
rootCmd.AddCommand(s3Cmd)
s3Cmd.Flags().StringP(flagConfig, "c", "", "Path to the configuration file. For example: ./s3.config.yaml")
s3Cmd.Flags().StringP(flagOutput, "o", "", "Path to the output folder. For example: ./output")
_ = s3Cmd.MarkFlagRequired(flagConfig)
_ = s3Cmd.MarkFlagRequired(flagOutput)
}