@@ -9,11 +9,7 @@ use clap::{Parser, Subcommand};
99use duct:: cmd;
1010use loco:: {
1111 generator:: {
12- executer,
13- extract_default_template,
14- extract_tree_template,
15- read_file_contents,
16- Generator
12+ executer, extract_default_template, extract_tree_template, read_file_contents, Generator ,
1713 } ,
1814 settings:: Settings ,
1915 wizard, Result , OS ,
@@ -136,12 +132,8 @@ fn main() -> Result<()> {
136132 "base_template"
137133 } ;
138134
139- let settings = Settings :: from_wizard (
140- & app_name,
141- & prompt_template_dir,
142- & user_selection,
143- os
144- ) ;
135+ let settings =
136+ Settings :: from_wizard ( & app_name, & prompt_template_dir, & user_selection, os) ;
145137 let template_path = Path :: new ( settings. template_dir . as_str ( ) ) ;
146138
147139 let generator_tmp_folder = if let Some ( _) = template_dir {
@@ -159,20 +151,19 @@ fn main() -> Result<()> {
159151 temp_to. root . as_path ( ) ,
160152 ) ;
161153
162-
163154 if let Ok ( path) = env:: var ( "LOCO_DEV_MODE_PATH" ) {
164155 println ! ( "⚠️ NOTICE: working in dev mode, pointing to local Loco on '{path}'" ) ;
165156 }
166157
167158 let dynamic_script_owner: Option < String > = if let Some ( path) = template_dir {
168159 let setup_filepath = format ! ( "{}/setup.rhai" , path) ; // Your line 168
169-
160+
170161 // Read the file and store the *owned String* in our `Option`.
171162 // We return the `Result` and `?` will propagate the error.
172163 Some ( read_file_contents ( setup_filepath. as_str ( ) ) ?)
173164 } else {
174165 None
175- } ;
166+ } ;
176167
177168 // 2. NOW, we can safely create the `script` borrow.
178169 let script = if let Some ( ref contents) = dynamic_script_owner {
@@ -182,10 +173,11 @@ fn main() -> Result<()> {
182173 } else {
183174 // Otherwise, `script` gets the static fallback.
184175 // (I am guessing this is what your `else` block had)
185- include_str ! ( "../../setup.rhai" )
176+ include_str ! ( "../../setup.rhai" )
186177 } ;
187178
188- let res = match Generator :: new ( Arc :: new ( executor) , settings) . run_from_script ( script) {
179+ let res = match Generator :: new ( Arc :: new ( executor) , settings) . run_from_script ( script)
180+ {
189181 Ok ( ( ) ) => {
190182 std:: fs:: create_dir_all ( & to) ?;
191183 let copy_options = fs_extra:: dir:: CopyOptions :: new ( ) . content_only ( true ) ;
0 commit comments