Expose NewRootCmd

Signed-off-by: Kimmo Lehto <kimmo.lehto@gmail.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
pull/10412/head
Kimmo Lehto 4 years ago committed by Kimmo Lehto
parent 5d47255a3d
commit 99d3c9e63c
No known key found for this signature in database
GPG Key ID: DD4E00A9C059F929

@ -43,10 +43,6 @@ const FeatureGateOCI = gates.Gate("HELM_EXPERIMENTAL_OCI")
var settings = cli.New() var settings = cli.New()
func init() {
log.SetFlags(log.Lshortfile)
}
func debug(format string, v ...interface{}) { func debug(format string, v ...interface{}) {
if settings.Debug { if settings.Debug {
format = fmt.Sprintf("[debug] %s\n", format) format = fmt.Sprintf("[debug] %s\n", format)
@ -60,6 +56,8 @@ func warning(format string, v ...interface{}) {
} }
func main() { func main() {
log.SetFlags(log.Lshortfile)
// Setting the name of the app for managedFields in the Kubernetes client. // Setting the name of the app for managedFields in the Kubernetes client.
// It is set here to the full name of "helm" so that renaming of helm to // It is set here to the full name of "helm" so that renaming of helm to
// another name (e.g., helm2 or helm3) does not change the name of the // another name (e.g., helm2 or helm3) does not change the name of the
@ -67,7 +65,7 @@ func main() {
kube.ManagedFieldsManager = "helm" kube.ManagedFieldsManager = "helm"
actionConfig := new(action.Configuration) actionConfig := new(action.Configuration)
cmd, err := newRootCmd(actionConfig, os.Stdout, os.Args[1:]) cmd, err := NewRootCmd(actionConfig, os.Stdout, os.Args[1:])
if err != nil { if err != nil {
warning("%+v", err) warning("%+v", err)
os.Exit(1) os.Exit(1)

@ -115,7 +115,7 @@ func executeActionCommandStdinC(store *storage.Storage, in *os.File, cmd string)
Log: func(format string, v ...interface{}) {}, Log: func(format string, v ...interface{}) {},
} }
root, err := newRootCmd(actionConfig, buf, args) root, err := NewRootCmd(actionConfig, buf, args)
if err != nil { if err != nil {
return nil, "", err return nil, "", err
} }

@ -83,7 +83,7 @@ By default, the default directories depend on the Operating System. The defaults
| Windows | %TEMP%\helm | %APPDATA%\helm | %APPDATA%\helm | | Windows | %TEMP%\helm | %APPDATA%\helm | %APPDATA%\helm |
` `
func newRootCmd(actionConfig *action.Configuration, out io.Writer, args []string) (*cobra.Command, error) { func NewRootCmd(actionConfig *action.Configuration, out io.Writer, args []string) (*cobra.Command, error) {
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "helm", Use: "helm",
Short: "The Helm package manager for Kubernetes.", Short: "The Helm package manager for Kubernetes.",

Loading…
Cancel
Save