File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -38,16 +38,21 @@ def require_uv():
3838def select_template (slug_name : str , framework : Optional [str ] = None ) -> TemplateConfig :
3939 """Let the user select a template from the ones available."""
4040 templates : list [TemplateConfig ] = get_all_templates ()
41- template_names = [shorten (f"⚡️ { t .name } - { t .description } " , 80 ) for t in templates ]
4241
43- empty_msg = "🆕 Empty Project"
44- template_choice = inquirer .list_input (
42+ EMPTY = 'empty'
43+ choices = [
44+ (EMPTY , "🆕 Empty Project" ),
45+ ]
46+ for template in templates :
47+ choices .append ((template .name , shorten (f"⚡️ { template .name } - { template .description } " , 80 )))
48+
49+ choice = inquirer .list_input (
4550 message = "Do you want to start with a template?" ,
46- choices = [empty_msg ] + template_names ,
51+ choices = [c [ 1 ] for c in choices ] ,
4752 )
48- template_name = template_choice . split ( "⚡️ " ) [1 ]. split ( " - " )[ 0 ]
53+ template_name = next ( c [ 0 ] for c in choices if c [1 ] == choice )
4954
50- if template_name == empty_msg :
55+ if template_name == EMPTY :
5156 return TemplateConfig (
5257 name = slug_name ,
5358 description = "" ,
You can’t perform that action at this time.
0 commit comments