@@ -127,44 +127,40 @@ func (f *DBFlagGroup) Flags() []Flagger {
127
127
}
128
128
}
129
129
130
- func (f * DBFlagGroup ) ToOptions () (DBOptions , error ) {
131
- if err := parseFlags (f ); err != nil {
132
- return DBOptions {}, err
133
- }
134
-
130
+ func (f * DBFlagGroup ) ToOptions (opts * Options ) error {
135
131
skipDBUpdate := f .SkipDBUpdate .Value ()
136
132
skipJavaDBUpdate := f .SkipJavaDBUpdate .Value ()
137
133
downloadDBOnly := f .DownloadDBOnly .Value ()
138
134
downloadJavaDBOnly := f .DownloadJavaDBOnly .Value ()
139
135
140
136
if downloadDBOnly && downloadJavaDBOnly {
141
- return DBOptions {}, xerrors .New ("--download-db-only and --download-java-db-only options can not be specified both" )
137
+ return xerrors .New ("--download-db-only and --download-java-db-only options can not be specified both" )
142
138
}
143
139
if downloadDBOnly && skipDBUpdate {
144
- return DBOptions {}, xerrors .New ("--skip-db-update and --download-db-only options can not be specified both" )
140
+ return xerrors .New ("--skip-db-update and --download-db-only options can not be specified both" )
145
141
}
146
142
if downloadJavaDBOnly && skipJavaDBUpdate {
147
- return DBOptions {}, xerrors .New ("--skip-java-db-update and --download-java-db-only options can not be specified both" )
143
+ return xerrors .New ("--skip-java-db-update and --download-java-db-only options can not be specified both" )
148
144
}
149
145
150
146
var dbRepositories , javaDBRepositories []name.Reference
151
147
for _ , repo := range f .DBRepositories .Value () {
152
148
ref , err := parseRepository (repo , db .SchemaVersion )
153
149
if err != nil {
154
- return DBOptions {}, xerrors .Errorf ("invalid DB repository: %w" , err )
150
+ return xerrors .Errorf ("invalid DB repository: %w" , err )
155
151
}
156
152
dbRepositories = append (dbRepositories , ref )
157
153
}
158
154
159
155
for _ , repo := range f .JavaDBRepositories .Value () {
160
156
ref , err := parseRepository (repo , javadb .SchemaVersion )
161
157
if err != nil {
162
- return DBOptions {}, xerrors .Errorf ("invalid javadb repository: %w" , err )
158
+ return xerrors .Errorf ("invalid javadb repository: %w" , err )
163
159
}
164
160
javaDBRepositories = append (javaDBRepositories , ref )
165
161
}
166
162
167
- return DBOptions {
163
+ opts . DBOptions = DBOptions {
168
164
Reset : f .Reset .Value (),
169
165
DownloadDBOnly : downloadDBOnly ,
170
166
SkipDBUpdate : skipDBUpdate ,
@@ -173,7 +169,8 @@ func (f *DBFlagGroup) ToOptions() (DBOptions, error) {
173
169
NoProgress : f .NoProgress .Value (),
174
170
DBRepositories : dbRepositories ,
175
171
JavaDBRepositories : javaDBRepositories ,
176
- }, nil
172
+ }
173
+ return nil
177
174
}
178
175
179
176
func parseRepository (repo string , dbSchemaVersion int ) (name.Reference , error ) {
0 commit comments