Skip to content

Commit 15ce689

Browse files
committed
feat: dev
1 parent 4a9ea16 commit 15ce689

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

.amazonq/plan/compare_template_files.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99

1010
def compare_files(file1: Path, file2: Path, label1: str, label2: str) -> bool:
1111
"""Compare two files and show differences. Returns True if identical."""
12-
print(f"\n{'='*60}")
13-
print(f"COMPARING: {file1.name}")
14-
print(f"{label1}: {file1}")
15-
print(f"{label2}: {file2}")
16-
print(f"{'='*60}")
12+
typer.echo(f"\n{'='*60}")
13+
typer.echo(f"COMPARING: {file1.name}")
14+
typer.echo(f"{label1}: {file1}")
15+
typer.echo(f"{label2}: {file2}")
16+
typer.echo(f"{'='*60}")
1717

1818
if not file1.exists():
19-
print(f"❌ MISSING: {file1} does not exist")
19+
typer.echo(f"❌ MISSING: {file1} does not exist")
2020
return False
2121

2222
if not file2.exists():
23-
print(f"❌ MISSING: {file2} does not exist")
23+
typer.echo(f"❌ MISSING: {file2} does not exist")
2424
return False
2525

2626
content1 = file1.read_text().splitlines(keepends=True)
@@ -37,12 +37,12 @@ def compare_files(file1: Path, file2: Path, label1: str, label2: str) -> bool:
3737
)
3838

3939
if not diff:
40-
print("✅ FILES IDENTICAL")
40+
typer.echo("✅ FILES IDENTICAL")
4141
return True
4242
else:
43-
print("❌ DIFFERENCES FOUND:")
43+
typer.echo("❌ DIFFERENCES FOUND:")
4444
for line in diff:
45-
print(line)
45+
typer.echo(line)
4646
return False
4747

4848

@@ -52,7 +52,7 @@ def main(
5252
):
5353
"""Compare files for template validation."""
5454
if mode not in ["template", "generated"]:
55-
print(f"❌ ERROR: Invalid mode '{mode}'. Use 'template' or 'generated'")
55+
typer.echo(f"❌ ERROR: Invalid mode '{mode}'. Use 'template' or 'generated'")
5656
return
5757

5858
base_dir = Path(__file__).parent.parent.parent
@@ -64,22 +64,22 @@ def main(
6464
dir1 = base_dir / "leetcode" / ".example" / problem
6565
dir2 = base_dir / ".templates" / "leetcode" / ".example" / "{{cookiecutter.problem_name}}"
6666
label1, label2 = "Reference", "Template"
67-
print("TEMPLATE SOURCE ANALYSIS")
67+
typer.echo("TEMPLATE SOURCE ANALYSIS")
6868

6969
elif mode == "generated":
7070
# Compare reference vs currently generated
7171
dir1 = base_dir / "leetcode" / ".example" / problem
7272
dir2 = base_dir / "leetcode" / problem
7373
label1, label2 = "Reference", "Generated"
74-
print("GENERATED FILES VALIDATION")
74+
typer.echo("GENERATED FILES VALIDATION")
7575

7676
if not dir2.exists():
77-
print(f"\n❌ ERROR: Generated directory does not exist: {dir2}")
78-
print(f"Run: make p-gen PROBLEM={problem}")
77+
typer.echo(f"\n❌ ERROR: Generated directory does not exist: {dir2}")
78+
typer.echo(f"Run: make p-gen PROBLEM={problem}")
7979
return
8080

81-
print(f"{label1}: {dir1}")
82-
print(f"{label2}: {dir2}")
81+
typer.echo(f"{label1}: {dir1}")
82+
typer.echo(f"{label2}: {dir2}")
8383

8484
identical_count = 0
8585
for filename in files_to_compare:
@@ -88,10 +88,10 @@ def main(
8888
if compare_files(file1, file2, label1, label2):
8989
identical_count += 1
9090

91-
print(f"\n{'='*60}")
92-
print(f"SUMMARY: {identical_count}/{len(files_to_compare)} files identical")
93-
print("- ✅ = Files identical")
94-
print("- ❌ = Differences found or missing files")
91+
typer.echo(f"\n{'='*60}")
92+
typer.echo(f"SUMMARY: {identical_count}/{len(files_to_compare)} files identical")
93+
typer.echo("- ✅ = Files identical")
94+
typer.echo("- ❌ = Differences found or missing files")
9595

9696

9797
if __name__ == "__main__":

0 commit comments

Comments
 (0)