Make console prompt configurable
parent
6e6e195bcf
commit
157b82b1a5
|
@ -133,7 +133,12 @@ Description: If this is true the builtin chatcommands and the redirect error mes
|
||||||
> `command_prefix`
|
> `command_prefix`
|
||||||
```
|
```
|
||||||
Type: String
|
Type: String
|
||||||
Description: Prefix of proxy chat commands, default is #
|
Description: The prefix of proxy chat commands, default is #
|
||||||
|
```
|
||||||
|
> `console_prompt`
|
||||||
|
```
|
||||||
|
Type: String
|
||||||
|
Description: The text preceeding the console input, default is ${command_prefix}>
|
||||||
```
|
```
|
||||||
> `do_fallback`
|
> `do_fallback`
|
||||||
```
|
```
|
||||||
|
|
12
console.go
12
console.go
|
@ -11,6 +11,16 @@ import (
|
||||||
var consoleInput []rune
|
var consoleInput []rune
|
||||||
|
|
||||||
func draw(msgs []string) {
|
func draw(msgs []string) {
|
||||||
|
prompt, ok := ConfKey("console_prompt").(string)
|
||||||
|
if !ok {
|
||||||
|
prefix, ok := ConfKey("command_prefix").(string)
|
||||||
|
if !ok {
|
||||||
|
prefix = "#"
|
||||||
|
}
|
||||||
|
|
||||||
|
prompt = prefix + ">"
|
||||||
|
}
|
||||||
|
|
||||||
gocurses.Clear()
|
gocurses.Clear()
|
||||||
|
|
||||||
row, _ := gocurses.Getmaxyx()
|
row, _ := gocurses.Getmaxyx()
|
||||||
|
@ -20,7 +30,7 @@ func draw(msgs []string) {
|
||||||
gocurses.Mvaddstr(row-i-1, 0, msg)
|
gocurses.Mvaddstr(row-i-1, 0, msg)
|
||||||
i--
|
i--
|
||||||
}
|
}
|
||||||
gocurses.Mvaddstr(row-i-1, 0, "> "+string(consoleInput))
|
gocurses.Mvaddstr(row-i-1, 0, prompt+string(consoleInput))
|
||||||
|
|
||||||
gocurses.Refresh()
|
gocurses.Refresh()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue