Remove the old implementation of print_versions.
Some checks failed
clippy Build clippy has failed
rust-foreign-document-test Build rust-foreign-document-test has succeeded
rust-build Build rust-build has succeeded
rust-test Build rust-test has succeeded

This commit is contained in:
Tom Alexander 2023-12-26 19:15:02 -05:00
parent 8186fbb8b3
commit e622d9fa6b
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
5 changed files with 6 additions and 49 deletions

View File

@ -1,3 +1,4 @@
#![feature(exit_status_error)]
#![feature(round_char_boundary)] #![feature(round_char_boundary)]
#![feature(exact_size_is_empty)] #![feature(exact_size_is_empty)]
use std::io::Read; use std::io::Read;
@ -5,6 +6,8 @@ use std::io::Read;
use organic::compare::run_anonymous_compare; use organic::compare::run_anonymous_compare;
use organic::compare::run_compare_on_file; use organic::compare::run_compare_on_file;
mod util;
#[cfg(feature = "tracing")] #[cfg(feature = "tracing")]
use crate::init_tracing::init_telemetry; use crate::init_tracing::init_telemetry;
#[cfg(feature = "tracing")] #[cfg(feature = "tracing")]

View File

@ -4,13 +4,12 @@ use crate::compare::diff::compare_document;
use crate::compare::diff::DiffResult; use crate::compare::diff::DiffResult;
use crate::compare::parse::emacs_parse_anonymous_org_document; use crate::compare::parse::emacs_parse_anonymous_org_document;
use crate::compare::parse::emacs_parse_file_org_document; use crate::compare::parse::emacs_parse_file_org_document;
use crate::compare::parse::get_emacs_version;
use crate::compare::parse::get_org_mode_version;
use crate::compare::sexp::sexp; use crate::compare::sexp::sexp;
use crate::context::GlobalSettings; use crate::context::GlobalSettings;
use crate::context::LocalFileAccessInterface; use crate::context::LocalFileAccessInterface;
use crate::parser::parse_file_with_settings; use crate::parser::parse_file_with_settings;
use crate::parser::parse_with_settings; use crate::parser::parse_with_settings;
use crate::util::print_versions;
pub async fn run_anonymous_compare<P: AsRef<str>>( pub async fn run_anonymous_compare<P: AsRef<str>>(
org_contents: P, org_contents: P,
@ -128,12 +127,3 @@ pub async fn run_compare_on_file_with_settings<'g, 's, P: AsRef<Path>>(
Ok(true) Ok(true)
} }
async fn print_versions() -> Result<(), Box<dyn std::error::Error>> {
eprintln!("Using emacs version: {}", get_emacs_version().await?.trim());
eprintln!(
"Using org-mode version: {}",
get_org_mode_version().await?.trim()
);
Ok(())
}

View File

@ -7,7 +7,6 @@ mod macros;
mod parse; mod parse;
mod sexp; mod sexp;
mod util; mod util;
pub(crate) use compare::print_versions;
pub use compare::run_anonymous_compare; pub use compare::run_anonymous_compare;
pub use compare::run_anonymous_compare_with_settings; pub use compare::run_anonymous_compare_with_settings;
pub use compare::run_compare_on_file; pub use compare::run_compare_on_file;

View File

@ -143,40 +143,3 @@ where
} }
output output
} }
pub async fn get_emacs_version() -> Result<String, Box<dyn std::error::Error>> {
let elisp_script = r#"(progn
(message "%s" (version))
)"#;
let mut cmd = Command::new("emacs");
let cmd = cmd
.arg("-q")
.arg("--no-site-file")
.arg("--no-splash")
.arg("--batch")
.arg("--eval")
.arg(elisp_script);
let out = cmd.output().await?;
out.status.exit_ok()?;
Ok(String::from_utf8(out.stderr)?)
}
pub async fn get_org_mode_version() -> Result<String, Box<dyn std::error::Error>> {
let elisp_script = r#"(progn
(org-mode)
(message "%s" (org-version nil t nil))
)"#;
let mut cmd = Command::new("emacs");
let cmd = cmd
.arg("-q")
.arg("--no-site-file")
.arg("--no-splash")
.arg("--batch")
.arg("--eval")
.arg(elisp_script);
let out = cmd.output().await?;
out.status.exit_ok()?;
Ok(String::from_utf8(out.stderr)?)
}

View File

@ -10,6 +10,8 @@ extern crate test;
#[cfg(feature = "compare")] #[cfg(feature = "compare")]
pub mod compare; pub mod compare;
#[cfg(feature = "compare")]
mod util;
mod context; mod context;
mod error; mod error;