feat: update dependencies and remove binary and command meta plugins
This commit is contained in:
committed by
Andrew Phillips (aider)
parent
40e4fcc74a
commit
52dc8cea32
@@ -4,6 +4,7 @@ use std::io::Read;
|
||||
use std::os::fd::FromRawFd;
|
||||
use crate::config;
|
||||
use crate::services::item_service::ItemService;
|
||||
use log::debug;
|
||||
|
||||
fn validate_diff_args(cmd: &mut Command, ids: &Vec<i64>, tags: &Vec<String>) {
|
||||
if !tags.is_empty() {
|
||||
@@ -35,8 +36,8 @@ fn fetch_and_validate_items(
|
||||
.get_item(conn, ids[1])
|
||||
.with_context(|| format!("Unable to find second item (ID: {}) in database", ids[1]))?;
|
||||
|
||||
log::debug!("MAIN: Found item A {:?}", item_a.item);
|
||||
log::debug!("MAIN: Found item B {:?}", item_b.item);
|
||||
debug!("MAIN: Found item A {:?}", item_a.item);
|
||||
debug!("MAIN: Found item B {:?}", item_b.item);
|
||||
|
||||
Ok((item_a, item_b))
|
||||
}
|
||||
@@ -94,7 +95,7 @@ fn spawn_diff_process(
|
||||
fd_a_read: libc::c_int,
|
||||
fd_b_read: libc::c_int,
|
||||
) -> Result<std::process::Child, anyhow::Error> {
|
||||
log::debug!("MAIN: Creating child process for diff");
|
||||
debug!("MAIN: Creating child process for diff");
|
||||
let mut diff_command = std::process::Command::new("diff");
|
||||
diff_command
|
||||
.arg("-u")
|
||||
@@ -157,10 +158,10 @@ fn write_item_to_pipe(
|
||||
let mut reader = engine.open(item_path)
|
||||
.map_err(|e| anyhow::anyhow!("Failed to open item: {}", e))?;
|
||||
|
||||
log::debug!("THREAD: Sending item to diff");
|
||||
debug!("THREAD: Sending item to diff");
|
||||
std::io::copy(&mut reader, &mut buffered_pipe_writer)
|
||||
.map_err(|e| anyhow::anyhow!("Failed to copy item to pipe: {}", e))?;
|
||||
log::debug!("THREAD: Done sending item to diff");
|
||||
debug!("THREAD: Done sending item to diff");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -188,12 +189,12 @@ fn execute_diff_command(
|
||||
.take()
|
||||
.expect("BUG: Failed to capture diff stderr pipe");
|
||||
|
||||
log::debug!("MAIN: Creating threads for diff I/O");
|
||||
debug!("MAIN: Creating threads for diff I/O");
|
||||
|
||||
// Thread to read diff's standard output
|
||||
let stdout_reader_thread = std::thread::spawn(move || {
|
||||
let mut output_buffer = Vec::new();
|
||||
log::debug!("STDOUT_READER: Reading diff stdout");
|
||||
debug!("STDOUT_READER: Reading diff stdout");
|
||||
// child_stdout_pipe is a ChildStdout, which implements std::io::Read
|
||||
child_stdout_pipe
|
||||
.read_to_end(&mut output_buffer)
|
||||
@@ -204,7 +205,7 @@ fn execute_diff_command(
|
||||
// Thread to read diff's standard error
|
||||
let stderr_reader_thread = std::thread::spawn(move || {
|
||||
let mut error_buffer = Vec::new();
|
||||
log::debug!("STDERR_READER: Reading diff stderr");
|
||||
debug!("STDERR_READER: Reading diff stderr");
|
||||
child_stderr_pipe
|
||||
.read_to_end(&mut error_buffer)
|
||||
.map_err(|e| anyhow::anyhow!("Failed to read diff stderr: {}", e))
|
||||
@@ -238,7 +239,7 @@ fn handle_diff_output(
|
||||
match diff_status.code() {
|
||||
Some(0) => {
|
||||
// Exit code 0: No differences
|
||||
log::debug!("MAIN: Diff successful, no differences found.");
|
||||
debug!("MAIN: Diff successful, no differences found.");
|
||||
// Typically, diff -u doesn't print to stdout if no differences.
|
||||
// But if it did, it would be shown here.
|
||||
if !stdout_capture_result.is_empty() {
|
||||
@@ -247,7 +248,7 @@ fn handle_diff_output(
|
||||
}
|
||||
Some(1) => {
|
||||
// Exit code 1: Differences found
|
||||
log::debug!("MAIN: Diff successful, differences found.");
|
||||
debug!("MAIN: Diff successful, differences found.");
|
||||
println!("{}", String::from_utf8_lossy(&stdout_capture_result));
|
||||
}
|
||||
Some(error_code) => {
|
||||
@@ -335,10 +336,10 @@ pub fn mode_diff(
|
||||
spawn_writer_thread(item_path_b.clone(), compression_type_b.clone(), fd_b_write);
|
||||
|
||||
// Wait for writer threads to complete (meaning all input has been sent to diff)
|
||||
log::debug!("MAIN: Waiting on writer thread for item A");
|
||||
debug!("MAIN: Waiting on writer thread for item A");
|
||||
match writer_thread_a.join() {
|
||||
Ok(Ok(())) => {
|
||||
log::debug!("MAIN: Writer thread for item A completed successfully.");
|
||||
debug!("MAIN: Writer thread for item A completed successfully.");
|
||||
}
|
||||
Ok(Err(e)) => {
|
||||
return Err(anyhow::anyhow!("Writer thread for item A failed: {}", e));
|
||||
@@ -352,10 +353,10 @@ pub fn mode_diff(
|
||||
}
|
||||
}
|
||||
|
||||
log::debug!("MAIN: Waiting on writer thread for item B");
|
||||
debug!("MAIN: Waiting on writer thread for item B");
|
||||
match writer_thread_b.join() {
|
||||
Ok(Ok(())) => {
|
||||
log::debug!("MAIN: Writer thread for item B completed successfully.");
|
||||
debug!("MAIN: Writer thread for item B completed successfully.");
|
||||
}
|
||||
Ok(Err(e)) => {
|
||||
return Err(anyhow::anyhow!("Writer thread for item B failed: {}", e));
|
||||
@@ -369,18 +370,18 @@ pub fn mode_diff(
|
||||
}
|
||||
}
|
||||
|
||||
log::debug!("MAIN: Done waiting on input-writer threads.");
|
||||
debug!("MAIN: Done waiting on input-writer threads.");
|
||||
|
||||
// Now that all input has been sent, the diff process will run to completion.
|
||||
// We can read its output. This will block until the process is finished.
|
||||
let (stdout_capture_result, stderr_capture_result) = execute_diff_command(&mut child_process)?;
|
||||
|
||||
// wait for the diff child process to terminate.
|
||||
log::debug!("MAIN: Waiting for diff child process to finish...");
|
||||
debug!("MAIN: Waiting for diff child process to finish...");
|
||||
let diff_status = child_process
|
||||
.wait()
|
||||
.map_err(|e| anyhow::anyhow!("Failed to wait on diff command: {}", e))?;
|
||||
log::debug!(
|
||||
debug!(
|
||||
"MAIN: Diff child process finished with status: {}",
|
||||
diff_status
|
||||
);
|
||||
|
||||
@@ -2,6 +2,7 @@ use clap::*;
|
||||
use is_terminal::IsTerminal;
|
||||
use std::path::PathBuf;
|
||||
use std::str::FromStr;
|
||||
use log::debug;
|
||||
|
||||
use crate::modes::common::{get_format_box_chars_no_border_line_separator, OutputFormat};
|
||||
use crate::config;
|
||||
@@ -344,12 +345,12 @@ pub fn mode_status(
|
||||
data_path: PathBuf,
|
||||
db_path: PathBuf,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
log::debug!("STATUS: Starting mode_status function");
|
||||
debug!("STATUS: Starting mode_status function");
|
||||
|
||||
// Determine which meta plugins would be enabled for a save operation
|
||||
log::debug!("STATUS: Getting meta plugin types from settings");
|
||||
debug!("STATUS: Getting meta plugin types from settings");
|
||||
let mut meta_plugin_types: Vec<MetaPluginType> = crate::modes::common::settings_meta_plugin_types(_cmd, settings);
|
||||
log::debug!("STATUS: Got {} meta plugin types", meta_plugin_types.len());
|
||||
debug!("STATUS: Got {} meta plugin types", meta_plugin_types.len());
|
||||
|
||||
// Always add the Digest plugin if not present
|
||||
if !meta_plugin_types.contains(&MetaPluginType::Digest) {
|
||||
@@ -364,9 +365,9 @@ pub fn mode_status(
|
||||
};
|
||||
|
||||
let output_format = crate::modes::common::settings_output_format(settings);
|
||||
log::debug!("STATUS: About to call generate_status_info");
|
||||
debug!("STATUS: About to call generate_status_info");
|
||||
let status_info = generate_status_info(data_path, db_path, &meta_plugin_types, enabled_compression_type);
|
||||
log::debug!("STATUS: generate_status_info completed successfully");
|
||||
debug!("STATUS: generate_status_info completed successfully");
|
||||
|
||||
match output_format {
|
||||
OutputFormat::Table => {
|
||||
@@ -377,11 +378,14 @@ pub fn mode_status(
|
||||
println!("PATHS:");
|
||||
build_path_table(&status_info.paths).printstd();
|
||||
println!();
|
||||
|
||||
println!("COMPRESSION:");
|
||||
build_compression_table(&status_info.compression).printstd();
|
||||
println!();
|
||||
|
||||
println!("META PLUGINS AVAILABLE:");
|
||||
build_meta_plugin_table(&status_info.meta_plugins).printstd();
|
||||
println!();
|
||||
|
||||
// Print META PLUGINS CONFIGURED if they exist
|
||||
if let Some(meta_plugins_table) = build_meta_plugins_configured_table(settings) {
|
||||
|
||||
Reference in New Issue
Block a user