github.com/elves/elvish@v0.15.0/pkg/cli/modeline.go (about)

     1  package cli
     2  
     3  import "github.com/elves/elvish/pkg/ui"
     4  
     5  // ModeLine returns a text styled as a modeline.
     6  func ModeLine(content string, space bool) ui.Text {
     7  	t := ui.T(content, ui.Bold, ui.FgWhite, ui.BgMagenta)
     8  	if space {
     9  		t = ui.Concat(t, ui.T(" "))
    10  	}
    11  	return t
    12  }
    13  
    14  // ModePrompt returns a callback suitable as the prompt in the codearea of a
    15  //
    16  func ModePrompt(content string, space bool) func() ui.Text {
    17  	p := ModeLine(content, space)
    18  	return func() ui.Text { return p }
    19  }