|
14 | 14 | from sys import argv |
15 | 15 |
|
16 | 16 | __author__ = "help@castellanidavide.it" |
17 | | -__version__ = "7.1 2021-02-13" |
| 17 | +__version__ = "7.9 2021-04-04" |
18 | 18 |
|
19 | 19 | class createstructure: |
20 | 20 | def __init__ (self, token=None, souces=['CastellaniDavide'], organization_name="", IGNORE=[], verbose=False, template=False, answers=None): |
@@ -201,23 +201,27 @@ def create_repo(self): |
201 | 201 | def choose_template(self): |
202 | 202 | """This helps to find the correct template |
203 | 203 | """ |
204 | | - # Add -template if not exists |
205 | | - if not self.ANSWERS['template'].endswith("-template"): |
206 | | - self.ANSWERS['template'] += "-template" |
207 | 204 |
|
208 | | - if "/" in self.ANSWERS['template']: # If it's yours |
209 | | - try: |
210 | | - self.template_name = self.g.get_repo(f"{self.ANSWERS['template']}").full_name |
211 | | - assert(self.g.get_repo(self.template_name).private == True) |
212 | | - except: |
213 | | - print(f"{self.get_emoji('i')}{self.ANSWERS['template']} not founded, now I want to use the default repo") |
214 | | - self.template_name = "createstructure/default-template" |
215 | | - else: # If you want to use the template into createstructure Organization |
216 | | - try: |
217 | | - self.template_name = self.g.get_repo(f"createstructure/{self.ANSWERS['template']}").full_name |
218 | | - except: |
219 | | - print(f"{self.get_emoji('i')}{self.ANSWERS['template']} not founded, now I want to use the default repo") |
220 | | - self.template_name = "createstructure/default-template" |
| 205 | + if self.ANSWERS['template'] == "": |
| 206 | + self.template_name = "createstructure/default-template" |
| 207 | + else: |
| 208 | + # Add -template if not exists |
| 209 | + if not self.ANSWERS['template'].endswith("-template"): |
| 210 | + self.ANSWERS['template'] += "-template" |
| 211 | + |
| 212 | + if "/" in self.ANSWERS['template']: # If it's yours |
| 213 | + try: |
| 214 | + self.template_name = self.g.get_repo(f"{self.ANSWERS['template']}").full_name |
| 215 | + assert(self.g.get_repo(self.template_name).private == True) |
| 216 | + except: |
| 217 | + print(f"{self.get_emoji('i')}{self.ANSWERS['template']} not founded, now I want to use the default repo") |
| 218 | + self.template_name = "createstructure/default-template" |
| 219 | + else: # If you want to use the template into createstructure Organization |
| 220 | + try: |
| 221 | + self.template_name = self.g.get_repo(f"createstructure/{self.ANSWERS['template']}").full_name |
| 222 | + except: |
| 223 | + print(f"{self.get_emoji('i')}{self.ANSWERS['template']} not founded, now I want to use the default repo") |
| 224 | + self.template_name = "createstructure/default-template" |
221 | 225 |
|
222 | 226 | self.template = self.g.get_repo(self.template_name) |
223 | 227 | print(f"{self.get_emoji('ok')}Template founded ({self.template_name})") |
|
0 commit comments