mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Also make lists and dicts of strings escape code safe
This commit is contained in:
@@ -6,14 +6,14 @@ import (
|
||||
"kitty/tools/utils"
|
||||
)
|
||||
|
||||
func parse_key_val_args(args []string) map[string]string {
|
||||
ans := make(map[string]string, len(args))
|
||||
func parse_key_val_args(args []string) map[escaped_string]escaped_string {
|
||||
ans := make(map[escaped_string]escaped_string, len(args))
|
||||
for _, arg := range args {
|
||||
key, value, found := utils.Cut(arg, "=")
|
||||
if found {
|
||||
ans[key] = value
|
||||
ans[escaped_string(key)] = escaped_string(value)
|
||||
} else {
|
||||
ans[key+"="] = ""
|
||||
ans[escaped_string(key+"=")] = ""
|
||||
}
|
||||
}
|
||||
return ans
|
||||
|
||||
@@ -46,6 +46,22 @@ func expand_ansi_c_escapes_in_args(args ...string) (escaped_string, error) {
|
||||
return escaped_string(strings.Join(args, " ")), nil
|
||||
}
|
||||
|
||||
func escape_list_of_strings(args []string) []escaped_string {
|
||||
ans := make([]escaped_string, len(args))
|
||||
for i, x := range args {
|
||||
ans[i] = escaped_string(x)
|
||||
}
|
||||
return ans
|
||||
}
|
||||
|
||||
func escape_dict_of_strings(args map[string]string) map[escaped_string]escaped_string {
|
||||
ans := make(map[escaped_string]escaped_string, len(args))
|
||||
for k, v := range args {
|
||||
ans[escaped_string(k)] = escaped_string(v)
|
||||
}
|
||||
return ans
|
||||
}
|
||||
|
||||
func set_payload_string_field(io_data *rc_io_data, field, data string) {
|
||||
payload_interface := reflect.ValueOf(&io_data.rc.Payload).Elem()
|
||||
struct_in_interface := reflect.New(payload_interface.Elem().Type()).Elem()
|
||||
|
||||
Reference in New Issue
Block a user