-
Notifications
You must be signed in to change notification settings - Fork 0
/
export.go
38 lines (31 loc) · 1.12 KB
/
export.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
/*
Copyright © 2022 NAME HERE <EMAIL ADDRESS>
*/
package cmd
import (
"github.com/gardener-community/gardener-chart-releaser/pkg/releaser"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
// exportCmd represents the export command
var exportCmd = &cobra.Command{
Use: "export",
Short: "Exports charts to a directory (requires GITHUB_TOKEN)",
Long: `This is a utility command which can be used for generating
a local development version of the charts. Once exported the charts
can be modified and tested. If you feel confident that your changes
also make sense for others you can go ahead and file pull requests in
the corresponding upstream repository.
This command requires the environmet variable GITHUB_TOKEN to be set.`,
Run: func(cmd *cobra.Command, args []string) {
config := releaser.Configuration{}
viper.Unmarshal(&config)
ghToken := viper.GetString("GITHUB_TOKEN")
targetDir := viper.GetString("targetDir")
releaser.ExportCharts(config, targetDir, ghToken)
},
}
func init() {
rootCmd.AddCommand(exportCmd)
exportCmd.Flags().String("targetDir", "charts", "The directory where charts are stored locally")
}