Skip to content

Commit

Permalink
removed unused libs
Browse files Browse the repository at this point in the history
Signed-off-by: Emre YILMAZ <[email protected]>
  • Loading branch information
delirehberi committed May 27, 2024
1 parent ce761e6 commit 6884368
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::env;
use std::fs::{self,File};
use std::io::{self,Write};
use std::path::Path;
use std::process::Command;
use tempfile::NamedTempFile;
use chrono::Local;
Expand All @@ -28,7 +26,7 @@ fn main() -> io::Result<()> {
let Config { editor, til_folder, repo_path } = config;
let full_til_path = format!("{}/{}",repo_path,til_folder);

let mut temp_file = NamedTempFile::new()?;
let temp_file = NamedTempFile::new()?;
let temp_path = temp_file.path().to_str().unwrap().to_string();

Command::new(editor)
Expand All @@ -37,22 +35,17 @@ fn main() -> io::Result<()> {
.expect("Failed to open editor");

let input_content = read_to_string(temp_path)?;
println!("Content is {}",&input_content);

let new_file_name = get_next_file_name(&full_til_path)?;
println!("New file name is {}", &new_file_name);

let new_file_path = format!("{}/{}", full_til_path, new_file_name);
println!("New file path is {}",&new_file_path);

let prepend_path = dirs::home_dir()
.expect("Failed to find home directory")
.join(format!(".config/{}/prepend.md",APP_NAME));

let prepend_template = read_to_string(prepend_path)?;
let prepend_content = update_prepend_content(&prepend_template,&new_file_name)?;
println!("Prepend content is {}",&prepend_content);
println!("File is creating: {}",&new_file_path);

let mut new_file = File::create(&new_file_path)?;
write!(new_file,"{} \n {}", prepend_content, input_content)?;
Expand Down

0 comments on commit 6884368

Please sign in to comment.