diff --git a/mikrotik_configurator/__main__.py b/mikrotik_configurator/__main__.py index 57a6b25..719366c 100644 --- a/mikrotik_configurator/__main__.py +++ b/mikrotik_configurator/__main__.py @@ -44,18 +44,6 @@ def main(): print("mixed up order") exit(1) - if args.reset and orders[0] != 0: - print("reset must start with 0_0") - exit(1) - - if not args.reset and orders[0] == 0: - print("not reset can't start with 0_0") - exit(1) - - if not dry_run and args.reset: - if not query_yes_no("Are you sure you want to reset configuration?", "no"): - exit(1) - def gen(x): s = f'\n/log info message="starting {x}..."\n' s += generator.render_file(x, cfg.get("include_dirs", []), cfg.get("variables", {})) @@ -75,6 +63,18 @@ def main(): print(script) return + if args.reset and orders[0] != 0: + print("reset must start with 0_0") + exit(1) + + if not args.reset and orders[0] == 0: + print("not reset can't start with 0_0") + exit(1) + + if not dry_run and args.reset: + if not query_yes_no("Are you sure you want to reset configuration?", "no"): + exit(1) + for index, line in enumerate(script.splitlines(), start=1): print('{:4d}: {}'.format(index, line.rstrip()))