mirror of
https://github.com/go-delve/delve.git
synced 2025-10-30 02:07:58 +08:00
terminal: config -list to print strings inside interfaces in quotes (#2680)
Commit 3d6bbbe9 made "config -list" print strings in quotes to avoid the strings being interpreted as terminal escape codes. This commit does the same for "source-list-line-color", which is a raw interface. This fixes "config -list" with a config like source-list-line-color: "\x1b[34m" The "int" variant is already printed correctly, so just use the default case for that.
This commit is contained in:
committed by
GitHub
parent
88b163d038
commit
f5105c57f7
@ -82,6 +82,13 @@ func configureList(t *Term) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch field.Kind() {
|
switch field.Kind() {
|
||||||
|
case reflect.Interface:
|
||||||
|
switch field := field.Interface().(type) {
|
||||||
|
case string:
|
||||||
|
fmt.Fprintf(w, "%s\t%q\n", fieldName, field)
|
||||||
|
default:
|
||||||
|
fmt.Fprintf(w, "%s\t%v\n", fieldName, field)
|
||||||
|
}
|
||||||
case reflect.Ptr:
|
case reflect.Ptr:
|
||||||
if !field.IsNil() {
|
if !field.IsNil() {
|
||||||
fmt.Fprintf(w, "%s\t%v\n", fieldName, field.Elem())
|
fmt.Fprintf(w, "%s\t%v\n", fieldName, field.Elem())
|
||||||
|
|||||||
Reference in New Issue
Block a user