github.com/kolbycrouch/elvish@v0.14.1-0.20210614162631-215b9ac1c423/pkg/cli/mode/mode.go (about) 1 // Package mode implements modes, which are widgets tailored for a specific 2 // task. 3 package mode 4 5 import "src.elv.sh/pkg/ui" 6 7 // Returns text styled as a modeline. 8 func modeLine(content string, space bool) ui.Text { 9 t := ui.T(content, ui.Bold, ui.FgWhite, ui.BgMagenta) 10 if space { 11 t = ui.Concat(t, ui.T(" ")) 12 } 13 return t 14 } 15 16 func modePrompt(content string, space bool) func() ui.Text { 17 p := modeLine(content, space) 18 return func() ui.Text { return p } 19 } 20 21 // Prompt returns a callback suitable as the prompt in the codearea of a 22 // mode widget. 23 var Prompt = modePrompt