diff --git a/nut/__main__.py b/nut/__main__.py index 9c95f1e..a76ba84 100644 --- a/nut/__main__.py +++ b/nut/__main__.py @@ -1,4 +1,5 @@ from .cli import CLI +from .commands.setup import is_nut_workspace, find_template_conflicts, copy_template_files def help_text(): return [ @@ -29,7 +30,20 @@ def main() -> int: return cli.run() def cmd_init(args, flags) -> int: - print("INIT", args, flags) + dest_dir = args[0] + force = flags["force"] + + conflicts = find_template_conflicts(dest_dir) + if conflicts and not force: + print("Some files already exist that would be overwritten:") + for file in conflicts: + print(f" {file}") + + print("Use --force to overwrite existing files.") + return 1 + + copy_template_files(dest_dir, force=force, checked=True) + return 0 if __name__ == "__main__": diff --git a/nut/commands/__init__.py b/nut/commands/__init__.py new file mode 100644 index 0000000..e69de29