@@ -7,11 +7,12 @@ const CONTENT_README: &str = "# A mod about {title}";
77const CONTENT_JSON_CONFIG : & str = r#"{
88 "isOpenSource": "{is_open_source}",
99 "canMessWithComputer": "{can_mess_with_computer}",
10-
10+ "type": "{type}",
11+
1112 "title": "{title}",
1213 "description": "{description}",
1314 "madeBy": "{made_by}",
14-
15+
1516 "downloadURL": "{download_url}",
1617 "externalURL": "{external_url}",
1718 "githubURL": "{github_url}",
@@ -21,6 +22,7 @@ const CONTENT_JSON_CONFIG: &str = r#"{
2122pub fn init_yes (
2223 path_to_logo : & str ,
2324 path_to_banner : & str ,
25+ what_type : Vec < i32 > ,
2426 is_open_source : & str ,
2527 can_mess_with_computer : & str ,
2628 title : & str ,
@@ -35,7 +37,7 @@ pub fn init_yes(
3537 // === === === config.json // readme.md === === ===
3638 let formatted_string = format ! ( "{}{}" , path_to_export, ".solar-engine" ) ;
3739 let extended_path = Path :: new ( & formatted_string) ;
38-
40+
3941 if extended_path. exists ( ) {
4042 let path_exists_prompt = boolean ( & format ! ( "`{}` {}" , path_to_export. bright_black( ) , "path exists. Do you wish to delete it?" . yellow( ) ) ) ;
4143
@@ -49,6 +51,15 @@ pub fn init_yes(
4951 fs:: create_dir ( extended_path) . unwrap ( ) ;
5052 }
5153
54+ let mut returned_type_shi: & str = "Other" ;
55+ for num in what_type {
56+ if num == 1 {
57+ returned_type_shi = "Scripts" ;
58+ } else if num == 2 {
59+ returned_type_shi = "Mods" ;
60+ }
61+ }
62+
5263 let populated_json = CONTENT_JSON_CONFIG
5364 . replace ( "{is_open_source}" , is_open_source)
5465 . replace ( "{can_mess_with_computer}" , can_mess_with_computer)
@@ -58,11 +69,12 @@ pub fn init_yes(
5869 . replace ( "{download_url}" , download_url)
5970 . replace ( "{external_url}" , external_url)
6071 . replace ( "{github_url}" , github_url)
61- . replace ( "{made_by_url}" , made_by_url) ;
62-
72+ . replace ( "{made_by_url}" , made_by_url)
73+ . replace ( "{type}" , returned_type_shi) ;
74+
6375 let formatted_readme = CONTENT_README
6476 . replace ( "{title}" , title) ;
65-
77+
6678 create_file ( & format ! ( "{}/readme.md" , formatted_string) , & formatted_readme) ;
6779 create_file ( & format ! ( "{}/config.json" , formatted_string) , & populated_json) ;
6880
@@ -79,4 +91,4 @@ pub fn init_yes(
7991fn create_file ( path_to : & str , content : & str ) {
8092 fs:: write ( path_to, content) . unwrap ( ) ;
8193 println ! ( "{} {}" , "Created" . green( ) , path_to. to_string( ) . white( ) ) ;
82- }
94+ }
0 commit comments