mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
...
This commit is contained in:
@@ -650,7 +650,10 @@ def gen_go_code(defn: Definition) -> str:
|
||||
a(f'default: return ans, fmt.Errorf("%#v is not a valid value for %s. Valid values are: %s", val, "{c}", "{vals}")')
|
||||
a('}''}')
|
||||
|
||||
has_parsers = bool(go_parsers or keyboard_shortcuts)
|
||||
a('func (c *Config) Parse(key, val string) (err error) {')
|
||||
if has_parsers:
|
||||
if go_parsers:
|
||||
a('switch key {')
|
||||
a('default: return fmt.Errorf("Unknown configuration key: %#v", key)')
|
||||
for oname, pname in go_parsers.items():
|
||||
@@ -674,6 +677,9 @@ def gen_go_code(defn: Definition) -> str:
|
||||
a('c.KeyboardShortcuts = append(c.KeyboardShortcuts, tempsc)')
|
||||
a('}')
|
||||
a('return}')
|
||||
else:
|
||||
a('return fmt.Errorf("Unknown configuration key: %#v", key)')
|
||||
a('}')
|
||||
return '\n'.join(lines)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user