MCPcopy Create free account
hub / github.com/carvel-dev/kapp-controller / getAppBuildName

Method getAppBuildName

cli/pkg/kctrl/cmd/app/init.go:102–134  ·  view source on GitHub ↗
(appBuild *buildconfigs.AppBuild)

Source from the content-addressed store, hash-verified

100}
101
102func (o *InitOptions) getAppBuildName(appBuild *buildconfigs.AppBuild) error {
103 o.ui.PrintHeaderText("\nBasic Information")
104 wd, err := os.Getwd()
105 if err != nil {
106 return err
107 }
108 defaultAppName := filepath.Base(wd)
109 appBuildObjectMeta := appBuild.GetObjectMeta()
110 if appBuildObjectMeta == nil {
111 appBuildObjectMeta = &metav1.ObjectMeta{}
112 }
113 if len(appBuildObjectMeta.Name) != 0 {
114 defaultAppName = appBuildObjectMeta.Name
115 }
116
117 textOpts := ui.TextOpts{
118 Label: "Enter the app name",
119 Default: defaultAppName,
120 ValidateFunc: nil,
121 }
122 appName, err := o.ui.AskForText(textOpts)
123 if err != nil {
124 return err
125 }
126 appBuildObjectMeta.Name = appName
127 appBuild.SetObjectMeta(appBuildObjectMeta)
128
129 err = appBuild.Save()
130 if err != nil {
131 return err
132 }
133 return nil
134}
135
136func (o *InitOptions) writeAppFile(appBuild *buildconfigs.AppBuild) error {
137 appConfig, err := o.generateApp(appBuild)

Callers 1

RunMethod · 0.95

Calls 5

PrintHeaderTextMethod · 0.65
GetObjectMetaMethod · 0.65
AskForTextMethod · 0.65
SetObjectMetaMethod · 0.65
SaveMethod · 0.65

Tested by

no test coverage detected