@@ -99,34 +99,27 @@ func diffKsCmdRun(cmd *cobra.Command, args []string) error {
99
99
}
100
100
101
101
var (
102
+ options []build.BuilderOptionFunc
102
103
builder * build.Builder
103
104
err error
104
105
)
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
+
105
118
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 ())
128
120
}
129
121
122
+ builder , err = build .NewBuilder (name , diffKsArgs .path , options ... )
130
123
if err != nil {
131
124
return & RequestError {StatusCode : 2 , Err : err }
132
125
}
0 commit comments