github.com/jmigpin/editor@v1.6.0/plugins/rownames/rownames.go (about) 1 package main 2 3 import ( 4 "sort" 5 "strings" 6 7 "github.com/jmigpin/editor/core" 8 "github.com/jmigpin/editor/core/toolbarparser" 9 ) 10 11 func ToolbarCmd(ed *core.Editor, erow *core.ERow, part *toolbarparser.Part) bool { 12 arg0 := part.Args[0].UnquotedString() 13 switch arg0 { 14 case "RowNames": 15 rowNames(ed) 16 return true 17 default: 18 return false 19 } 20 } 21 22 func rowNames(ed *core.Editor) { 23 u := []string{} 24 for _, info := range ed.ERowInfos() { 25 u = append(u, info.Name()) 26 } 27 sort.Strings(u) 28 msg := "rownames:\n\t" + strings.Join(u, "\n\t") 29 ed.Messagef(msg) 30 }