@@ -99,34 +99,27 @@ func diffKsCmdRun(cmd *cobra.Command, args []string) error {
9999 }
100100
101101 var (
102+ options []build.BuilderOptionFunc
102103 builder * build.Builder
103104 err error
104105 )
106+
107+ options = append (options ,
108+ build .WithClientConfig (kubeconfigArgs , kubeclientOptions ),
109+ build .WithTimeout (rootArgs .timeout ),
110+ build .WithKustomizationFile (diffKsArgs .kustomizationFile ),
111+ build .WithIgnore (diffKsArgs .ignorePaths ),
112+ build .WithStrictSubstitute (diffKsArgs .strictSubst ),
113+ build .WithRecursive (diffKsArgs .recursive ),
114+ build .WithLocalSources (diffKsArgs .localSources ),
115+ build .WithSingleKustomization (),
116+ )
117+
105118 if diffKsArgs .progressBar {
106- builder , err = build .NewBuilder (name , diffKsArgs .path ,
107- build .WithClientConfig (kubeconfigArgs , kubeclientOptions ),
108- build .WithTimeout (rootArgs .timeout ),
109- build .WithKustomizationFile (diffKsArgs .kustomizationFile ),
110- build .WithProgressBar (),
111- build .WithIgnore (diffKsArgs .ignorePaths ),
112- build .WithStrictSubstitute (diffKsArgs .strictSubst ),
113- build .WithRecursive (diffKsArgs .recursive ),
114- build .WithLocalSources (diffKsArgs .localSources ),
115- build .WithSingleKustomization (),
116- )
117- } else {
118- builder , err = build .NewBuilder (name , diffKsArgs .path ,
119- build .WithClientConfig (kubeconfigArgs , kubeclientOptions ),
120- build .WithTimeout (rootArgs .timeout ),
121- build .WithKustomizationFile (diffKsArgs .kustomizationFile ),
122- build .WithIgnore (diffKsArgs .ignorePaths ),
123- build .WithStrictSubstitute (diffKsArgs .strictSubst ),
124- build .WithRecursive (diffKsArgs .recursive ),
125- build .WithLocalSources (diffKsArgs .localSources ),
126- build .WithSingleKustomization (),
127- )
119+ options = append (options , build .WithProgressBar ())
128120 }
129121
122+ builder , err = build .NewBuilder (name , diffKsArgs .path , options ... )
130123 if err != nil {
131124 return & RequestError {StatusCode : 2 , Err : err }
132125 }
0 commit comments