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, set_option_cmd, set_option_v3_cmd, generate_v3
from .s23_options_util import get_option_schema, generate_v3
from .batch_cmd import execute_batch_command
def set_option(name: str, cs: ChangeSet) -> ChangeSet:
v2_cmd = set_option_cmd(name, cs)
result = execute_command(name, v2_cmd)
v3 = generate_v3(ChangeSet(v2_cmd.redo_cs[0]))
v3_cmd = set_option_v3_cmd(name, v3)
result.merge(execute_command(name, v3_cmd))
return result
new_cs = cs
new_cs.merge(generate_v3(cs))
return execute_batch_command(name, new_cs)
def inp_in_option(section: list[str]) -> ChangeSet: