Refine option to support batch command

This commit is contained in:
WQY\qiong
2023-03-08 22:56:29 +08:00
parent 3c3c29de90
commit 690e3aa09a
6 changed files with 35 additions and 19 deletions

View File

@@ -1,16 +1,12 @@
from .database import *
from .s23_options_util import get_option_schema, get_option_v3_schema, set_option_v3_cmd, set_option_cmd, generate_v2, generate_v3
from .s23_options_util import get_option_schema, get_option_v3_schema, generate_v2, generate_v3
from .batch_cmd import execute_batch_command
def set_option_v3(name: str, cs: ChangeSet) -> ChangeSet:
v3_cmd = set_option_v3_cmd(name, cs)
result = execute_command(name, v3_cmd)
v2 = generate_v2(ChangeSet(v3_cmd.redo_cs[0]))
v2_cmd = set_option_cmd(name, v2)
result.merge(execute_command(name, v2_cmd))
return result
new_cs = cs
new_cs.merge(generate_v2(cs))
return execute_batch_command(name, new_cs)
def _parse_v2(v2_lines: list[str]) -> dict[str, str]: