diff options
Diffstat (limited to 'pkgs/by-name/ts/tskm/src/interface/neorg/mod.rs')
-rw-r--r-- | pkgs/by-name/ts/tskm/src/interface/neorg/mod.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/pkgs/by-name/ts/tskm/src/interface/neorg/mod.rs b/pkgs/by-name/ts/tskm/src/interface/neorg/mod.rs new file mode 100644 index 00000000..51d58ab3 --- /dev/null +++ b/pkgs/by-name/ts/tskm/src/interface/neorg/mod.rs @@ -0,0 +1,25 @@ +use std::path::PathBuf; + +use anyhow::Result; + +use crate::task::{run_task, Project}; + +pub mod handle; +pub use handle::handle; + +impl Project { + /// Return the stored neorg path of this project. + /// The returned path will never start with a slash (/). + pub(super) fn get_neorg_path(&self) -> Result<PathBuf> { + let project_path = run_task(&[ + "_get", + format!("rc.context.{}.rc.neorg_path", self.to_context_display()).as_str(), + ])?; + + let final_path = project_path + .strip_prefix('/') + .unwrap_or(project_path.as_str()); + + Ok(PathBuf::from(final_path)) + } +} |