Replace validate arg with apply arg

This commit is contained in:
LilyRose2798 2024-04-20 20:24:38 +10:00
parent 0232ce9c44
commit 022398e275
1 changed files with 7 additions and 8 deletions

View File

@ -305,7 +305,7 @@ def main():
parser = ArgumentParser("woven") parser = ArgumentParser("woven")
parser.add_argument("-q", "--quiet", action = "store_true", help = "decrease output verbosity") parser.add_argument("-q", "--quiet", action = "store_true", help = "decrease output verbosity")
parser.add_argument("-c", "--config", default = "mesh-config.json", help = "the path to the config file") parser.add_argument("-c", "--config", default = "mesh-config.json", help = "the path to the config file")
parser.add_argument("-v", "--validate", action = "store_true", help = "only validate the config without applying it") parser.add_argument("-a", "--apply", action = "store_true", help = "apply the configuration")
args = parser.parse_args() args = parser.parse_args()
with redirect_stdout(open(devnull, "w") if args.quiet else stdout): with redirect_stdout(open(devnull, "w") if args.quiet else stdout):
@ -323,8 +323,7 @@ def main():
err_str = "\n".join(transform_error(e)) err_str = "\n".join(transform_error(e))
print(f"The following validation errors occurred when loading the configuration file:\n{err_str}", file = stderr) print(f"The following validation errors occurred when loading the configuration file:\n{err_str}", file = stderr)
exit(1) exit(1)
if args.validate: if args.apply:
return
try: try:
config.apply() config.apply()
except Exception as e: except Exception as e: