示例#1
0
文件: main.go 项目: edma2/classy
func plumbDir1(dir string, w io.Writer) error {
	m := plumb.Message{
		Src:  "navigator",
		Dst:  "edit",
		Type: "text",
		Data: []byte(dir),
	}
	log.Printf("Sending to plumber: %s\n", m)
	return m.Send(w)
}
示例#2
0
文件: main.go 项目: edma2/classy
func plumbFile(m *plumb.Message, w io.Writer, name, path string) error {
	m.Src = "navigator"
	m.Dst = ""
	m.Data = []byte(path)
	var attr *plumb.Attribute
	for attr = m.Attr; attr != nil; attr = attr.Next {
		if attr.Name == "addr" {
			break
		}
	}
	if attr == nil {
		if leafName := leafOf(name); leafName != "" {
			addr := fmt.Sprintf("/(trait|class|object|interface)[ 	]*%s/", leafName)
			m.Attr = &plumb.Attribute{Name: "addr", Value: addr, Next: m.Attr}
		}
	}
	log.Printf("Sending to plumber: %s\n", m)
	return m.Send(w)
}