(appBuild *buildconfigs.AppBuild)
| 100 | } |
| 101 | |
| 102 | func (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 | |
| 136 | func (o *InitOptions) writeAppFile(appBuild *buildconfigs.AppBuild) error { |
| 137 | appConfig, err := o.generateApp(appBuild) |
no test coverage detected