Add a generated comment in *_generated.go in the style used by go generate
This commit is contained in:
parent
21b572d69a
commit
833e9625f9
@ -3,16 +3,16 @@
|
|||||||
|
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
from functools import lru_cache
|
|
||||||
from contextlib import contextmanager, suppress
|
from contextlib import contextmanager, suppress
|
||||||
|
from functools import lru_cache
|
||||||
from typing import Dict, Iterator, List, Set, Tuple, Union
|
from typing import Dict, Iterator, List, Set, Tuple, Union
|
||||||
|
|
||||||
import kitty.constants as kc
|
import kitty.constants as kc
|
||||||
from kittens.tui.operations import Mode
|
from kittens.tui.operations import Mode
|
||||||
from kitty.cli import (
|
from kitty.cli import (
|
||||||
GoOption, go_options_for_seq, parse_option_spec,
|
GoOption, go_options_for_seq, parse_option_spec, serialize_as_go_string
|
||||||
serialize_as_go_string
|
|
||||||
)
|
)
|
||||||
from kitty.key_encoding import config_mod_map
|
from kitty.key_encoding import config_mod_map
|
||||||
from kitty.key_names import (
|
from kitty.key_names import (
|
||||||
@ -220,8 +220,6 @@ def generate_constants() -> str:
|
|||||||
ref_map = load_ref_map()
|
ref_map = load_ref_map()
|
||||||
dp = ", ".join(map(lambda x: f'"{serialize_as_go_string(x)}"', kc.default_pager_for_help))
|
dp = ", ".join(map(lambda x: f'"{serialize_as_go_string(x)}"', kc.default_pager_for_help))
|
||||||
return f'''\
|
return f'''\
|
||||||
// auto-generated by {__file__} do no edit
|
|
||||||
|
|
||||||
package kitty
|
package kitty
|
||||||
|
|
||||||
type VersionType struct {{
|
type VersionType struct {{
|
||||||
@ -253,6 +251,7 @@ def replace_if_needed(path: str) -> Iterator[io.StringIO]:
|
|||||||
with suppress(FileNotFoundError), open(path, 'r') as f:
|
with suppress(FileNotFoundError), open(path, 'r') as f:
|
||||||
orig = f.read()
|
orig = f.read()
|
||||||
new = buf.getvalue()
|
new = buf.getvalue()
|
||||||
|
new = f'// Code generated by {os.path.basename(__file__)}; DO NOT EDIT.\n\n' + new
|
||||||
if orig != new:
|
if orig != new:
|
||||||
changed.append(path)
|
changed.append(path)
|
||||||
with open(path, 'w') as f:
|
with open(path, 'w') as f:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user