blob: ed24c2cbf808e91c8751225e37c77edaa1443450 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
// nixos-config - My current NixOS configuration
//
// Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de>
// SPDX-License-Identifier: GPL-3.0-or-later
//
// This file is part of my nixos-config.
//
// You should have received a copy of the License along with this program.
// If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>.
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))
}
}
|