@@ -19,11 +19,12 @@ class Clone(GitSimBaseCommand):
1919 def init_repo (self ):
2020 pass
2121
22- def __init__ (self , url : str ):
22+ def __init__ (self , url : str , path : str ):
2323 super ().__init__ ()
2424 self .url = url
25+ self .path = path
2526 settings .max_branches_per_commit = 2
26- self .cmd += f"{ type (self ).__name__ .lower ()} { self .url } "
27+ self .cmd += f"{ type (self ).__name__ .lower ()} { self .url + ( '' if self . path == '.' else ' ' + self . path ) } "
2728
2829 def construct (self ):
2930 if not settings .stdout and not settings .output_only_path and not settings .quiet :
@@ -37,11 +38,19 @@ def construct(self):
3738 repo_name = repo_name .group (1 )
3839 if repo_name .endswith (".git" ):
3940 repo_name = repo_name [:- 4 ]
41+ elif self .url == "." or self .url == "./" or self .url == ".\\ " :
42+ repo_name = os .path .split (os .getcwd ())[1 ]
4043 else :
4144 print (
4245 f"git-sim error: Invalid repo URL, please confirm repo URL and try again"
4346 )
4447 sys .exit (1 )
48+
49+ if self .url == os .path .join (self .path , repo_name ):
50+ print (
51+ f"git-sim error: Cannot clone into same path, please try again"
52+ )
53+ sys .exit (1 )
4554 new_dir = os .path .join (tempfile .gettempdir (), "git_sim" , repo_name )
4655
4756 # Create local clone of local repo
@@ -71,7 +80,7 @@ def construct(self):
7180
7281 def add_details (self , repo_name ):
7382 text1 = m .Text (
74- f"Successfully cloned from { self .url } into ./ { repo_name } " ,
83+ f"Successfully cloned from { self .url } into { repo_name if self . path == '.' else self . path } " ,
7584 font = self .font ,
7685 font_size = 20 ,
7786 color = self .fontColor ,
0 commit comments