diff --git a/README.md b/README.md index 2882294..c20578a 100644 --- a/README.md +++ b/README.md @@ -7,100 +7,126 @@ Whenever you need to take notes, Nost helps you create files following the struc For example, if you add a note on the 6th of June 2025: ```txt - 2025/ - 06/ - 1/ - 03.md +2025/ + 06/ + 1/ + 06.md ``` -## Create a not +## Prerequisites +- [Rust](https://www.rust-lang.org/tools/install) (includes `cargo`) + +## Build the app + +```sh +cargo build --release ``` -cargo run not + +Optional: add an alias + +```sh +alias nost="RUST_LOG=warn /path/to/nost/target/release/nost" ``` -Or +## Configure the app + +Copy `config.toml.dist` into `config.toml` and update the values. For example: + +```toml +not_path="/path/to/your/notes" +language="fr" +``` + +## Create a note +```sh +cargo run new ``` + +Or + +```sh cargo run n ``` -## (WIP) Use not for working +## Create a new folder -Begin a work session: +```sh +cargo run new-folder +``` + +Or +```sh +cargo run nf ``` + +## Work sessions (WIP) + +Begin a work session: + +```sh cargo run start-work ``` Or -``` +```sh cargo run sw ``` End a work session: -``` +```sh cargo run end-work ``` Or -``` +```sh cargo run ew ``` -For now, the data is only annotated, but these annotations are not yet used or processed. - -## Test +Display work stats: -Unit tests: - -``` -cargo test +```sh +cargo run work-stats ``` -Style: +Or -``` -cargo clippy --verbose -- -D warnings +```sh +cargo run ws ``` -Linter: - -``` -cargo fmt -- --check -``` +For now, the data is only annotated, but these annotations are not yet used or processed. -## Configure the app +### Work plugin configuration -Copy `config.toml.dist` into `config.toml` and update the values. For example: +For computing work stats, add some env vars: -```toml -not_path="/home/gaetan/not" -language="fr" +```sh +export NOST_WORK_SALARY=0 +export NOST_WORK_CURRENCY=EUR ``` -## Build the app +## Development -Build the app with cargo +Unit tests: ```sh -cargo build --release +cargo test ``` -Optional: add an alias +Style: ```sh -alias nost="RUST_LOG=warn /your/path/for/nost-not/nost/target/release/nost" +cargo clippy --verbose -- -D warnings ``` -## Work plugin - -For computing work stats, add some env vars: +Linter: ```sh -export NOST_WORK_SALARY=0 -export NOST_WORK_CURRENCY=EUR +cargo fmt -- --check ``` diff --git a/src/commands/new_folder.rs b/src/commands/new_folder.rs index 2709540..199e757 100644 --- a/src/commands/new_folder.rs +++ b/src/commands/new_folder.rs @@ -15,7 +15,7 @@ pub fn new_folder() -> std::io::Result { println!("✅ Folder has been created successfully!"); // create a the config { "created_at": "2025-12-31T23:59:59Z", "type": "day" } - let config_file_path = format!("{}{}", &new_folder_path, ".not-config.json"); + let config_file_path = format!("{}{}", new_folder_path, ".not-config.json"); match File::create(&config_file_path) { Ok(_file) => { @@ -28,7 +28,7 @@ pub fn new_folder() -> std::io::Result { }; // create the default file in the folder - let default_file_path = format!("{}{}", &new_folder_path, "not.md"); + let default_file_path = format!("{}{}", new_folder_path, "not.md"); match File::create(&default_file_path) { Ok(_file) => { diff --git a/src/files/create.rs b/src/files/create.rs index a1d8663..859a5e8 100644 --- a/src/files/create.rs +++ b/src/files/create.rs @@ -31,7 +31,7 @@ pub fn create_file(title: Option) -> std::io::Result { None => name(), }; - let full_not_file_path = format!("{}{}", ¬_file_path, not_file_name); + let full_not_file_path = format!("{}{}", not_file_path, not_file_name); // create folders if needed if let Err(e) = create_dir_all(¬_file_path) { @@ -85,14 +85,14 @@ pub fn create_note_file_with_folders(note_type: String) -> std::io::Result = Local::now(); let today_file_name = get_day_as_string(now); let today_file_path = format!( "{}{}{}{}{}", - &today_folder_path, today_file_name, ".", note_type, ".md" + today_folder_path, today_file_name, ".", note_type, ".md" ); // only create if not does not already exists @@ -111,7 +111,7 @@ pub fn create_note_file_with_folders(note_type: String) -> std::io::Result String { stats_content.push_str(&format!( "| {} | {} | {:.2} | {:.2} |\n", - &weekday, &work_stat.day, hours, cumulative_week_hours + weekday, work_stat.day, hours, cumulative_week_hours )); } } diff --git a/src/projects/initialize.rs b/src/projects/initialize.rs index 5d0f12f..32d2b8f 100644 --- a/src/projects/initialize.rs +++ b/src/projects/initialize.rs @@ -9,7 +9,7 @@ pub fn get_project_config_path() -> String { eprintln!("NOT_PATH environment variable not set."); std::process::exit(1); }); - format!("{}/{}/", ¬_path, ".nost") + format!("{}/{}/", not_path, ".nost") } /** @@ -22,10 +22,10 @@ pub fn is_project_initialized() -> bool { std::process::exit(1); }); - let project_config_path = format!("{}/.nost/project.json", ¬_path,); + let project_config_path = format!("{}/.nost/project.json", not_path); log::debug!( "Checking if configuration exists at path: {}", - &project_config_path + project_config_path ); Path::new(&project_config_path).is_file() } @@ -54,9 +54,9 @@ pub fn initialize_project() -> Result> { create_dir_all(&configuration_path)?; // create en empty configuration file - let default_config_path = format!("{}{}", &configuration_path, "project.json"); + let default_config_path = format!("{}{}", configuration_path, "project.json"); let config_file = std::fs::File::create(&default_config_path)?; - log::debug!("Configuration initialized at path: {}", &configuration_path); + log::debug!("Configuration initialized at path: {}", configuration_path); // append inital content to the configuration file const NOST_VERSION: &str = env!("CARGO_PKG_VERSION");