Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 68 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
4 changes: 2 additions & 2 deletions src/commands/new_folder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn new_folder() -> std::io::Result<String> {
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) => {
Expand All @@ -28,7 +28,7 @@ pub fn new_folder() -> std::io::Result<String> {
};

// 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) => {
Expand Down
8 changes: 4 additions & 4 deletions src/files/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub fn create_file(title: Option<String>) -> std::io::Result<String> {
None => name(),
};

let full_not_file_path = format!("{}{}", &not_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(&not_file_path) {
Expand Down Expand Up @@ -85,14 +85,14 @@ pub fn create_note_file_with_folders(note_type: String) -> std::io::Result<Strin

log::debug!(
"🚨 Creating note file with folders at path: {}",
&today_folder_path
today_folder_path
);

let now: DateTime<Local> = 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
Expand All @@ -111,7 +111,7 @@ pub fn create_note_file_with_folders(note_type: String) -> std::io::Result<Strin

log::debug!(
"🚨 Creating note file with folders at path: {}",
&today_file_path
today_file_path
);

// create the file
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/gdarquie_work/work.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ pub fn compose_monthly_work_stats(stats: MonthlyWorkStats) -> 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
));
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/projects/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub fn get_project_config_path() -> String {
eprintln!("NOT_PATH environment variable not set.");
std::process::exit(1);
});
format!("{}/{}/", &not_path, ".nost")
format!("{}/{}/", not_path, ".nost")
}

/**
Expand All @@ -22,10 +22,10 @@ pub fn is_project_initialized() -> bool {
std::process::exit(1);
});

let project_config_path = format!("{}/.nost/project.json", &not_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()
}
Expand Down Expand Up @@ -54,9 +54,9 @@ pub fn initialize_project() -> Result<String, Box<dyn std::error::Error>> {
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");
Expand Down