Skip to content

Commit 8c14995

Browse files
committed
docs: add README.md
also format with `cargo fmt`
1 parent 5ac9da2 commit 8c14995

2 files changed

Lines changed: 27 additions & 4 deletions

File tree

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# A Directory Manager for [Neorg](https://github.com/nvim-neorg/neorg)
2+
3+
The `neorg-dirman` crate is a core module which provides a basic interface for workspaces.
4+
5+
Workspaces are the backbone of [Neorg](https://github.com/nvim-neorg/neorg) - they are
6+
a directory with an assigned name whose files are `.norg` notes belonging to a specific
7+
area of focus.
8+
9+
This crate exposes a
10+
[`Workspace`](https://docs.rs/neorg-dirman/latest/neorg_dirman/workspace/struct.Workspace.html)
11+
struct as well as a
12+
[`WorkspaceManager`](https://docs.rs/neorg-dirman/latest/neorg_dirman/workspace/struct.WorkspaceManager.html)
13+
to easily keep track of many workspaces as well as the current ("active")
14+
workspace. A
15+
[`files()`](https://docs.rs/neorg-dirman/latest/neorg_dirman/workspace/struct.Workspace.html#method.files)
16+
function is also provided to enumerate all files within a given workspace.

src/workspace.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,16 @@ mod tests {
132132
path: "~/another/path".into(),
133133
};
134134

135-
let mut workspace_manager = WorkspaceManager::new(vec![&workspace1, &workspace2], &workspace1.name).expect("Workspace 1 not found!");
136-
workspace_manager.set_current_workspace(&workspace2.name).expect("Unable to set the current workspace");
137-
138-
assert_eq!(&workspace_manager.get_current_workspace().name, &workspace2.name);
135+
let mut workspace_manager =
136+
WorkspaceManager::new(vec![&workspace1, &workspace2], &workspace1.name)
137+
.expect("Workspace 1 not found!");
138+
workspace_manager
139+
.set_current_workspace(&workspace2.name)
140+
.expect("Unable to set the current workspace");
141+
142+
assert_eq!(
143+
&workspace_manager.get_current_workspace().name,
144+
&workspace2.name
145+
);
139146
}
140147
}

0 commit comments

Comments
 (0)