Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/noot/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def cmd_init(args):
msg = f"[bold green]Project '{project_name}' initialized![/bold green]"
console.print(f"\n{msg}")
console.print("\n[dim]Created:[/dim]")
console.print(" .git/")
console.print(f" src/{project_name}/__init__.py")
console.print(f" cli/{project_name}.py")
console.print(f" tests/test_{project_name}.py")
Expand Down
5 changes: 5 additions & 0 deletions src/noot/init.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Project initialization for noot."""

import subprocess
from pathlib import Path


Expand All @@ -8,6 +9,7 @@ def init_project(target_dir: Path, project_name: str) -> None:
Initialize a noot project in the target directory.

Creates:
- .git/ (git repository)
- pyproject.toml (project configuration)
- src/{project_name}/__init__.py (package)
- cli/{project_name}.py (sample CLI)
Expand Down Expand Up @@ -50,6 +52,9 @@ def init_project(target_dir: Path, project_name: str) -> None:
"Package may be incorrectly installed."
)

# Initialize git repository
subprocess.run(["git", "init"], cwd=target_dir, check=True, capture_output=True)

# Create directory structure
(target_dir / "src" / project_name).mkdir(parents=True, exist_ok=True)
(target_dir / "cli").mkdir(exist_ok=True)
Expand Down
3 changes: 3 additions & 0 deletions tests/test_init_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ def test_init_command_creates_project():
assert result.returncode == 0, f"Command failed: {result.stderr}"
assert "initialized" in result.stdout.lower()

# Verify git repository initialized
assert (tmpdir / ".git").is_dir()

# Verify pyproject.toml at root
assert (tmpdir / "pyproject.toml").exists()

Expand Down