MCPcopy
hub / github.com/mislav/hub / TestArgsParser_WithUsage

Function TestArgsParser_WithUsage

utils/args_parser_test.go:185–201  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

183}
184
185func TestArgsParser_WithUsage(t *testing.T) {
186 p := NewArgsParserWithUsage(`
187 -L, --limit N
188 retrieve at most N records
189 -d, --draft
190 save as draft
191 --message=<msg>, -m <msg>
192 set message body
193 `)
194 args := []string{"-L24", "-d", "-mhello"}
195 rest, err := p.Parse(args)
196 equal(t, nil, err)
197 equal(t, []string{}, rest)
198 equal(t, "24", p.Value("--limit"))
199 equal(t, true, p.Bool("--draft"))
200 equal(t, "hello", p.Value("--message"))
201}

Callers

nothing calls this directly

Calls 5

NewArgsParserWithUsageFunction · 0.85
equalFunction · 0.85
ValueMethod · 0.80
BoolMethod · 0.80
ParseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…