Skip to content

Commit 16a878d

Browse files
authored
Fix prompts showing before required flag errors (#2219)
Move preRunInstall call to RunE to fix prompts showing before required flag errors
1 parent cdaf41b commit 16a878d

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

cmd/installer/cli/install.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,18 +109,14 @@ func InstallCmd(ctx context.Context, name string) *cobra.Command {
109109
cmd := &cobra.Command{
110110
Use: "install",
111111
Short: fmt.Sprintf("Install %s", name),
112-
PreRunE: func(cmd *cobra.Command, args []string) error {
113-
if err := preRunInstall(cmd, &flags); err != nil {
114-
return err
115-
}
116-
117-
return nil
118-
},
119112
PostRun: func(cmd *cobra.Command, args []string) {
120113
runtimeconfig.Cleanup()
121114
cancel() // Cancel context when command completes
122115
},
123116
RunE: func(cmd *cobra.Command, args []string) error {
117+
if err := preRunInstall(cmd, &flags); err != nil {
118+
return err
119+
}
124120
clusterID := metrics.ClusterID()
125121
metricsReporter := NewInstallReporter(
126122
replicatedAppURL(), clusterID, cmd.CalledAs(), flagsToStringSlice(cmd.Flags()),

0 commit comments

Comments
 (0)