MCPcopy Index your code
hub / github.com/larksuite/cli / parseReadTarget

Function parseReadTarget

cmd/skill/skill.go:161–173  ·  view source on GitHub ↗

parseReadTarget maps 1-or-2 positional args to (name, relpath); a lone " / " splits on the first '/', and relpath "" reads the main SKILL.md.

(args []string)

Source from the content-addressed store, hash-verified

159// parseReadTarget maps 1-or-2 positional args to (name, relpath); a lone
160// "<a>/<b>" splits on the first '/', and relpath "" reads the main SKILL.md.
161func parseReadTarget(args []string) (name, relpath string, err error) {
162 switch len(args) {
163 case 1:
164 name, relpath = skillcontent.SplitArg(args[0])
165 return name, relpath, nil
166 case 2:
167 return args[0], args[1], nil
168 default:
169 return "", "", errs.NewValidationError(errs.SubtypeInvalidArgument,
170 "read requires 1 or 2 arguments: <name>[/<path>] [path]").
171 WithHint("run 'lark-cli skills read --help'")
172 }
173}
174
175// readGuidance routes cross-skill "../lark-foo/..." references back through
176// `skills read lark-foo/...`: the path guard rejects a literal "../", so the

Callers 1

newReadCmdFunction · 0.85

Calls 3

SplitArgFunction · 0.92
NewValidationErrorFunction · 0.92
WithHintMethod · 0.45

Tested by

no test coverage detected