MCPcopy Index your code
hub / github.com/coder/coder / parse

Method parse

cli/exp_scaletest.go:322–368  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

320}
321
322func (s *scaletestOutputFlags) parse() ([]scaleTestOutput, error) {
323 var stdoutFormat scaleTestOutputFormat
324
325 validFormats := map[scaleTestOutputFormat]struct{}{
326 scaleTestOutputFormatText: {},
327 scaleTestOutputFormatJSON: {},
328 }
329
330 var out []scaleTestOutput
331 for i, o := range s.outputSpecs {
332 parts := strings.SplitN(o, ":", 2)
333 format := scaleTestOutputFormat(parts[0])
334 if _, ok := validFormats[format]; !ok {
335 return nil, xerrors.Errorf("invalid output format %q in output flag %d", parts[0], i)
336 }
337
338 if len(parts) == 1 {
339 if stdoutFormat != "" {
340 return nil, xerrors.Errorf("multiple output flags specified for stdout")
341 }
342 stdoutFormat = format
343 continue
344 }
345 if len(parts) != 2 {
346 return nil, xerrors.Errorf("invalid output flag %d: %q", i, o)
347 }
348
349 out = append(out, scaleTestOutput{
350 format: format,
351 path: parts[1],
352 })
353 }
354
355 // Default to --output text
356 if stdoutFormat == "" && len(out) == 0 {
357 stdoutFormat = scaleTestOutputFormatText
358 }
359
360 if stdoutFormat != "" {
361 out = append([]scaleTestOutput{{
362 format: stdoutFormat,
363 path: "-",
364 }}, out...)
365 }
366
367 return out, nil
368}
369
370type scaletestPrometheusFlags struct {
371 Address string

Callers 15

ParseMethod · 0.80
scaletestChatMethod · 0.80
scaletestTaskStatusMethod · 0.80
scaletestBridgeMethod · 0.80
scaletestPrebuildsMethod · 0.80
scaletestDashboardMethod · 0.80
scaletestAutostartMethod · 0.80

Calls 2

scaleTestOutputFormatTypeAlias · 0.85
ErrorfMethod · 0.45

Tested by 5

ParseMethod · 0.64
expectReconnectScheduleFunction · 0.64
readStoredRecordsFunction · 0.64
parseStoredDraftsFunction · 0.64
TestingScreenFunction · 0.64