env.go 451 B

123456789101112131415161718192021
  1. // License: GPLv3 Copyright: 2022, Kovid Goyal, <kovid at kovidgoyal.net>
  2. package at
  3. import (
  4. "strings"
  5. )
  6. func parse_key_val_args(args []string) map[escaped_string]escaped_string {
  7. ans := make(map[escaped_string]escaped_string, len(args))
  8. for _, arg := range args {
  9. key, value, found := strings.Cut(arg, "=")
  10. if found {
  11. ans[escaped_string(key)] = escaped_string(value)
  12. } else {
  13. ans[escaped_string(key+"=")] = ""
  14. }
  15. }
  16. return ans
  17. }