mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-24 09:18:08 +02:00
Work on conversion of args parsing to go code
This commit is contained in:
20
tools/cmd/at/env.go
Normal file
20
tools/cmd/at/env.go
Normal file
@@ -0,0 +1,20 @@
|
||||
// License: GPLv3 Copyright: 2022, Kovid Goyal, <kovid at kovidgoyal.net>
|
||||
|
||||
package at
|
||||
|
||||
import (
|
||||
"kitty/tools/utils"
|
||||
)
|
||||
|
||||
func parse_key_val_args(args []string) map[string]string {
|
||||
ans := make(map[string]string, len(args))
|
||||
for _, arg := range args {
|
||||
key, value, found := utils.Cut(arg, "=")
|
||||
if found {
|
||||
ans[key] = value
|
||||
} else {
|
||||
ans[key+"="] = ""
|
||||
}
|
||||
}
|
||||
return ans
|
||||
}
|
||||
Reference in New Issue
Block a user