Fix feature gating the compare code.
This commit is contained in:
parent
cd1b4ba785
commit
44ad6753ca
11
src/main.rs
11
src/main.rs
@ -1,9 +1,13 @@
|
|||||||
#![feature(round_char_boundary)]
|
#![feature(round_char_boundary)]
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
|
#[cfg(feature = "compare")]
|
||||||
use ::organic::parser::document;
|
use ::organic::parser::document;
|
||||||
|
#[cfg(feature = "compare")]
|
||||||
use organic::compare_document;
|
use organic::compare_document;
|
||||||
|
#[cfg(feature = "compare")]
|
||||||
use organic::emacs_parse_org_document;
|
use organic::emacs_parse_org_document;
|
||||||
|
#[cfg(feature = "compare")]
|
||||||
use organic::parser::sexp::sexp_with_padding;
|
use organic::parser::sexp::sexp_with_padding;
|
||||||
|
|
||||||
use crate::init_tracing::init_telemetry;
|
use crate::init_tracing::init_telemetry;
|
||||||
@ -21,6 +25,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "compare")]
|
||||||
fn run_compare<P: AsRef<Path>>(todo_org_path: P) -> Result<(), Box<dyn std::error::Error>> {
|
fn run_compare<P: AsRef<Path>>(todo_org_path: P) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let org_contents = std::fs::read_to_string(todo_org_path.as_ref()).expect("Read org file.");
|
let org_contents = std::fs::read_to_string(todo_org_path.as_ref()).expect("Read org file.");
|
||||||
let (remaining, rust_parsed) = document(org_contents.as_str()).expect("Org Parse failure");
|
let (remaining, rust_parsed) = document(org_contents.as_str()).expect("Org Parse failure");
|
||||||
@ -49,3 +54,9 @@ fn run_compare<P: AsRef<Path>>(todo_org_path: P) -> Result<(), Box<dyn std::erro
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "compare"))]
|
||||||
|
fn run_compare<P: AsRef<Path>>(_todo_org_path: P) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
println!("This program was built with compare disabled. Doing nothing.");
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user