11import os
2- import shutil
32from datetime import datetime
43from pathlib import Path
54from typing import Dict , Optional
98
109from app .commands .check .git import git
1110from app .exercise_config import ExerciseConfig
11+ from app .utils .cli import rmtree
1212from app .utils .click import error , info , success , warn
1313from app .utils .gh_cli import (
1414 clone_with_custom_name ,
2121 download_file ,
2222 execute_py_file_function_from_url ,
2323 exercise_exists ,
24- generate_cds_string ,
2524 get_gitmastery_file_path ,
2625 get_variable_from_url ,
2726 read_gitmastery_exercise_config ,
@@ -127,7 +126,7 @@ def download(ctx: click.Context, exercise: str) -> None:
127126
128127 if os .path .isdir (exercise ):
129128 warn (f"You already have { exercise } , removing it to download again" )
130- shutil . rmtree (exercise )
129+ rmtree (exercise )
131130
132131 os .makedirs (exercise )
133132 os .chdir (exercise )
@@ -151,7 +150,7 @@ def download(ctx: click.Context, exercise: str) -> None:
151150 # Rollback the download and remove the folder
152151 warn ("Git is not setup. Rolling back the download" )
153152 os .chdir (".." )
154- shutil . rmtree (formatted_exercise )
153+ rmtree (formatted_exercise )
155154 warn ("Setup Git before downloading this exercise" )
156155 exit (1 )
157156
@@ -166,7 +165,7 @@ def download(ctx: click.Context, exercise: str) -> None:
166165 # Rollback the download and remove the folder
167166 warn ("Github is not setup. Rolling back the download" )
168167 os .chdir (".." )
169- shutil . rmtree (formatted_exercise )
168+ rmtree (formatted_exercise )
170169 warn ("Setup Github and Github CLI before downloading this exercise" )
171170 exit (1 )
172171
0 commit comments