org-cli 0.0.3

Command-line tool for searching, reading, and managing org-mode knowledge bases with fuzzy text search and structured content access
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::config::CliConfig;
use anyhow::Result;
use clap::Args;
use org_core::OrgMode;

#[derive(Args)]
pub struct ElementByIdCommand {
    /// The ID of the element to extract
    id: String,
}

impl ElementByIdCommand {
    pub fn execute(&self, org_mode: OrgMode, _cli: CliConfig) -> Result<()> {
        let content = org_mode.get_element_by_id(&self.id)?;
        println!("{}", content);
        Ok(())
    }
}