Finish implementation of config file parsing

Still needs tests
This commit is contained in:
Kovid Goyal
2023-02-18 16:52:16 +05:30
parent 70086451e7
commit 747411be00
7 changed files with 331 additions and 14 deletions

View File

@@ -179,6 +179,14 @@ def get_kitten_conf_docs(kitten: str) -> Optional[Definition]:
return cast(Definition, ans)
def get_kitten_extra_cli_parsers(kitten: str) -> Dict[str,str]:
setattr(sys, 'extra_cli_parsers', {})
run_kitten(kitten, run_name='__extra_cli_parsers__')
ans = getattr(sys, 'extra_cli_parsers')
delattr(sys, 'extra_cli_parsers')
return cast(Dict[str, str], ans)
def main() -> None:
try:
args = sys.argv[1:]

View File

@@ -724,3 +724,6 @@ elif __name__ == '__wrapper_of__':
elif __name__ == '__conf__':
from .options.definition import definition
sys.options_definition = definition # type: ignore
elif __name__ == '__extra_cli_parsers__':
from .copy import option_text
setattr(sys, 'extra_cli_parsers', {'copy': option_text()}) # type: ignore