MCPcopy
hub / github.com/matryer/xbar / parseParams

Function parseParams

pkg/plugins/item_params.go:109–121  ·  view source on GitHub ↗

parseParams parses the parameters from a single line. The string without parameters is returned, along with the typed ItemParams.

(s string)

Source from the content-addressed store, hash-verified

107// The string without parameters is returned, along with the
108// typed ItemParams.
109func parseParams(s string) (string, ItemParams, error) {
110 params := defaultParams
111 pipeIndex := strings.Index(s, "|")
112 if pipeIndex < 0 { // no params
113 return s, params, nil
114 }
115 text := s[:pipeIndex]
116 paramStr := s[pipeIndex+1:]
117 if err := parseParamStr(&params, paramStr); err != nil {
118 return text, params, err
119 }
120 return text, params, nil
121}
122
123// parseParamStr parses the parameter string, updating params.
124func parseParamStr(params *ItemParams, s string) error {

Callers 2

TestParseParamsFunction · 0.85
parseOutputMethod · 0.85

Calls 1

parseParamStrFunction · 0.85

Tested by 1

TestParseParamsFunction · 0.68