Skip to content

Commit

Permalink
renamed Note to Notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
falk-werner committed Jan 27, 2024
1 parent 3def5c7 commit a46407c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ mod config;
mod note;

use config::{Config};
use note::{Note};
use note::{Notebook};

fn main() {
let config = Config::from_default_file();
let note = Note::new(config);
let notebook = Notebook::new(config);

tauri::Builder::default()
.manage(note)
.manage(notebook)
.invoke_handler(tauri::generate_handler![
list
])
Expand All @@ -24,7 +24,7 @@ fn main() {
///
/// list all directories in the base directory that have a `README.md` file inside
#[tauri::command]
async fn list(note: tauri::State<'_, Note>) -> std::result::Result<Vec<String>, String> {
Ok(note.list())
async fn list(notebook: tauri::State<'_, Notebook>) -> std::result::Result<Vec<String>, String> {
Ok(notebook.list_notes())
}

8 changes: 4 additions & 4 deletions src-tauri/src/note.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
use std::{fs::DirEntry, io::{Error, Result}, path::{Path, PathBuf}};
use crate::config::{Config};

pub struct Note {
pub struct Notebook {
config: Config
}

impl Note {
impl Notebook {

/// Creates a new Note struct.
pub fn new(config: Config) -> Self {
Note { config }
Notebook { config }
}


/// list the names of the notes
///
/// list all directories in the base directory that have a `README.md` file inside
pub fn list(&self) -> Vec<String> {
pub fn list_notes(&self) -> Vec<String> {
let base_path = self.config.get_base_path().join(".notes");
match get_note_names(base_path) {
Ok(note_names) => return note_names,
Expand Down

0 comments on commit a46407c

Please sign in to comment.