11extern crate regex;
22
33use std:: {
4- env , fs:: { self , File } , io:: Write , process
4+ fs:: { self , File } , io:: Write , process
55} ;
66
77use askama:: Template ;
@@ -70,28 +70,31 @@ struct Prettier {}
7070#[ template( path = ".github/workflows/ci.yaml" , escape = "none" ) ]
7171struct GHWorkflowCI { }
7272
73- fn append_eof ( content : String ) -> String {
74- let os = env:: consts:: OS ;
75- let mut s = content. clone ( ) ;
76- if os == "windows" {
77- println ! ( "windows append" ) ;
78- s. push_str ( "\r \n " ) ;
79- } else if os == "macos" {
80- println ! ( "macos append" ) ;
81- s. push ( '\n' ) ;
82- } else if os == "linux" {
83- println ! ( "linux append" ) ;
84- s. push ( '\n' ) ;
85- } else {
86- println ! ( "else append" ) ;
87- s. push ( '\n' ) ;
88- }
73+ fn append_eof ( mut s : String ) -> String {
74+ // let os = env::consts::OS;
75+ // if os == "windows" {
76+ // println!("windows append");
77+ // s.push_str("\r\n");
78+ // } else if os == "macos" {
79+ // println!("macos append");
80+ // s.push_str("\nblah");
81+ // s.push_str("\r\n");
82+
83+ // // s.push('\n');
84+ // } else if os == "linux" {
85+ // println!("linux append");
86+ // s.push('\n');
87+ // } else {
88+ // println!("else append");
89+ // s.push('\n');
90+ // }
91+ s. push ( '\n' ) ;
8992 s
9093}
9194
92- pub fn setup_preset ( mut preset : String , name : String , create : bool ) {
95+ pub fn setup_preset ( mut preset : & str , name : String , create : bool ) {
9396 if preset == "python" {
94- preset = "python3.10" . to_string ( ) ;
97+ preset = "python3.10" ;
9598 }
9699 let mut prefix: String = "./" . to_string ( ) ;
97100 if create {
@@ -117,7 +120,7 @@ pub fn setup_preset(mut preset: String, name: String, create: bool) {
117120
118121 // Render Poetry conf
119122 let re = Regex :: new ( r"python(3\.\d+|4\.\d+)" ) . unwrap ( ) ;
120- let ( python_ver, black_target_ver) = if let Some ( caps) = re. captures ( & preset) {
123+ let ( python_ver, black_target_ver) = if let Some ( caps) = re. captures ( preset) {
121124 let ver = caps[ 1 ] . to_string ( ) ;
122125 ( ver. clone ( ) , format ! ( "py{}" , ver. replace( '.' , "" ) ) )
123126 } else {
0 commit comments