MCPcopy Create free account
hub / github.com/conforma/cli / mutate

Method mutate

internal/format/target.go:44–75  ·  view source on GitHub ↗

mutate parses the given string as URL query parameters and sets the fields according to the parsed values

(given string)

Source from the content-addressed store, hash-verified

42// mutate parses the given string as URL query parameters and sets the fields
43// according to the parsed values
44func (o *Options) mutate(given string) error {
45 vals, err := url.ParseQuery(given)
46 if err != nil {
47 return err
48 }
49
50 if v := vals.Get("show-successes"); v != "" {
51 if f, err := strconv.ParseBool(v); err == nil {
52 o.ShowSuccesses = f
53 } else {
54 return err
55 }
56 }
57
58 if v := vals.Get("show-warnings"); v != "" {
59 if f, err := strconv.ParseBool(v); err == nil {
60 o.ShowWarnings = f
61 } else {
62 return err
63 }
64 }
65
66 if v := vals.Get("show-policy-docs-link"); v != "" {
67 if f, err := strconv.ParseBool(v); err == nil {
68 o.ShowPolicyDocsLink = f
69 } else {
70 return err
71 }
72 }
73
74 return nil
75}
76
77// Write proxies the write operation to the underlying writer.
78func (t *Target) Write(data []byte) (int, error) {

Callers 1

ParseMethod · 0.80

Calls 1

GetMethod · 0.80

Tested by

no test coverage detected