MCPcopy Create free account
hub / github.com/astercloud/aster / Load

Method Load

pkg/commands/loader.go:34–44  ·  view source on GitHub ↗

Load 加载命令定义

(ctx context.Context, commandName string)

Source from the content-addressed store, hash-verified

32
33// Load 加载命令定义
34func (cl *CommandLoader) Load(ctx context.Context, commandName string) (*CommandDefinition, error) {
35 // 读取 {commandName}.md
36 path := filepath.Join(cl.baseDir, commandName+".md")
37
38 content, err := cl.fs.Read(ctx, path)
39 if err != nil {
40 return nil, fmt.Errorf("read command file: %w", err)
41 }
42
43 return cl.parse(commandName, content)
44}
45
46// parse 解析命令文件
47func (cl *CommandLoader) parse(name, content string) (*CommandDefinition, error) {

Callers

nothing calls this directly

Calls 3

parseMethod · 0.95
ReadMethod · 0.65
JoinMethod · 0.45

Tested by

no test coverage detected