Skip to content

Commit 3b1f7b6

Browse files
committed
clean
1 parent a9f127a commit 3b1f7b6

File tree

2 files changed

+25
-22
lines changed

2 files changed

+25
-22
lines changed

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@ fn main() {
4040
println!("Creating project with name: {}", args.name);
4141
println!("Using preset: {:?} ", args.preset);
4242
if args.preset.starts_with("python") {
43-
setup_preset(args.preset, args.name, true);
43+
setup_preset(&args.preset, args.name, true);
4444
} else {
4545
eprintln!("Preset: {:?} not supported", args.preset);
4646
}
4747
}
4848
Cli::Update(args) => {
4949
println!("Updating project with preset: {:?}", args.preset);
50-
setup_preset(args.preset, "".to_string(), false);
50+
setup_preset(&args.preset, "".to_string(), false);
5151
}
5252
}
5353
}

src/python.rs

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
extern crate regex;
22

33
use std::{
4-
env, fs::{self, File}, io::Write, process
4+
fs::{self, File}, io::Write, process
55
};
66

77
use askama::Template;
@@ -70,28 +70,31 @@ struct Prettier {}
7070
#[template(path = ".github/workflows/ci.yaml", escape = "none")]
7171
struct 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

Comments
 (0)