@@ -21,14 +21,18 @@ var (
21
21
"prompt-loading" , false ,
22
22
"is prompt query not yet done rendering" ,
23
23
)
24
- flgRColorMode = cmdRender .PersistentFlags ().String (
25
- "color -mode" , "none" ,
26
- "color rendering mode of the prompt (zsh, ascii, none)" ,
24
+ flgREscapeMode = cmdRender .PersistentFlags ().String (
25
+ "escape -mode" , "none" ,
26
+ "color / escape rendering mode of the prompt (zsh, ascii, none)" ,
27
27
)
28
28
flgRMode = cmdRender .PersistentFlags ().String (
29
29
"prompt-mode" , "normal" ,
30
30
"mode of the prompt (normal, edit)" ,
31
31
)
32
+ flgRPromptStartMark = cmdRender .PersistentFlags ().String (
33
+ "prompt-mark-start" , "" ,
34
+ "mark to place at the start of the prompt (first prompt line)" ,
35
+ )
32
36
)
33
37
34
38
func init () {
@@ -61,7 +65,7 @@ func setColorMode(mode string) {
61
65
magentaC = wrapC ("%F{magenta}" , "%F{reset}" )
62
66
greyC = wrapC ("%F{black}" , "%F{reset}" )
63
67
newline = "\n %{\r %}"
64
-
68
+
65
69
} else if mode == "ascii" {
66
70
redC = color .Red .Render
67
71
greenC = color .Green .Render
@@ -74,7 +78,7 @@ func setColorMode(mode string) {
74
78
}
75
79
76
80
func cmdRenderRun (_ * cobra.Command , _ []string ) error {
77
- setColorMode (* flgRColorMode )
81
+ setColorMode (* flgREscapeMode )
78
82
79
83
if _ , err := os .Stdin .Stat (); err != nil {
80
84
fmt .Printf ("%#v" , err )
@@ -258,7 +262,14 @@ func cmdRenderRun(_ *cobra.Command, _ []string) error {
258
262
}
259
263
promptLines = append (promptLines , promptMarker )
260
264
261
- fmt .Print (strings .Join (promptLines , newline ))
265
+ // Add prompt mark to last line
266
+ lastLine := len (promptLines ) - 1
267
+ if lastLine >= 0 {
268
+ promptLines [lastLine ] = fmt .Sprintf ("%v%v" , * flgRPromptStartMark , promptLines [lastLine ])
269
+ }
270
+
271
+ fullPrompt := strings .Join (promptLines , newline )
272
+ fmt .Print (fullPrompt )
262
273
263
274
return nil
264
275
}
0 commit comments