fix: Correct module paths and conditional compilation for magic feature
Co-authored-by: aider (openai/andrew/openrouter/sonoma-sky-alpha) <aider@aider.chat>
This commit is contained in:
@@ -29,7 +29,9 @@ use filter_plugin::{
|
|||||||
// Import all meta plugins to ensure they register themselves
|
// Import all meta plugins to ensure they register themselves
|
||||||
#[allow(unused_imports)]
|
#[allow(unused_imports)]
|
||||||
use meta_plugin::{
|
use meta_plugin::{
|
||||||
magic_file, cwd, text, user, shell, shell_pid, keep_pid, digest,
|
#[cfg(feature = "magic")]
|
||||||
|
magic_file,
|
||||||
|
cwd, text, user, shell, shell_pid, keep_pid, digest,
|
||||||
read_time, read_rate, hostname, exec, env
|
read_time, read_rate, hostname, exec, env
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,10 @@ use std::collections::HashMap;
|
|||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
|
|
||||||
|
#[cfg(feature = "magic")]
|
||||||
|
pub mod magic_file;
|
||||||
pub mod exec;
|
pub mod exec;
|
||||||
pub mod digest;
|
pub mod digest;
|
||||||
pub mod magic_file;
|
|
||||||
pub mod text;
|
pub mod text;
|
||||||
pub mod read_time;
|
pub mod read_time;
|
||||||
pub mod read_rate;
|
pub mod read_rate;
|
||||||
@@ -18,9 +19,10 @@ pub mod shell_pid;
|
|||||||
pub mod keep_pid;
|
pub mod keep_pid;
|
||||||
pub mod env;
|
pub mod env;
|
||||||
|
|
||||||
|
#[cfg(feature = "magic")]
|
||||||
|
pub use magic_file::MagicFileMetaPlugin;
|
||||||
pub use exec::MetaPluginExec;
|
pub use exec::MetaPluginExec;
|
||||||
pub use digest::DigestMetaPlugin;
|
pub use digest::DigestMetaPlugin;
|
||||||
pub use magic_file::MagicFileMetaPlugin;
|
|
||||||
pub use text::TextMetaPlugin;
|
pub use text::TextMetaPlugin;
|
||||||
pub use read_time::ReadTimeMetaPlugin;
|
pub use read_time::ReadTimeMetaPlugin;
|
||||||
pub use read_rate::ReadRateMetaPlugin;
|
pub use read_rate::ReadRateMetaPlugin;
|
||||||
@@ -124,6 +126,7 @@ impl MetaPlugin for BaseMetaPlugin {
|
|||||||
#[derive(Debug, Eq, PartialEq, Clone, Hash, strum::EnumIter, strum::Display, strum::EnumString, Serialize, Deserialize)]
|
#[derive(Debug, Eq, PartialEq, Clone, Hash, strum::EnumIter, strum::Display, strum::EnumString, Serialize, Deserialize)]
|
||||||
#[strum(serialize_all = "snake_case", ascii_case_insensitive)]
|
#[strum(serialize_all = "snake_case", ascii_case_insensitive)]
|
||||||
pub enum MetaPluginType {
|
pub enum MetaPluginType {
|
||||||
|
#[cfg(feature = "magic")]
|
||||||
MagicFile,
|
MagicFile,
|
||||||
Cwd,
|
Cwd,
|
||||||
Text,
|
Text,
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ fn spawn_writer_thread(
|
|||||||
compression_type: crate::compression_engine::CompressionType,
|
compression_type: crate::compression_engine::CompressionType,
|
||||||
fd_write: libc::c_int,
|
fd_write: libc::c_int,
|
||||||
) -> std::thread::JoinHandle<Result<(), anyhow::Error>> {
|
) -> std::thread::JoinHandle<Result<(), anyhow::Error>> {
|
||||||
|
#[allow(unsafe_code)]
|
||||||
let pipe_writer_raw = unsafe { std::fs::File::from_raw_fd(fd_write) };
|
let pipe_writer_raw = unsafe { std::fs::File::from_raw_fd(fd_write) };
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
write_item_to_pipe(item_path, compression_type, pipe_writer_raw)
|
write_item_to_pipe(item_path, compression_type, pipe_writer_raw)
|
||||||
|
|||||||
@@ -64,7 +64,8 @@ pub fn mode_generate_config(_cmd: &mut Command, _settings: &crate::config::Setti
|
|||||||
let cwd_plugin = crate::meta_plugin::cwd::CwdMetaPlugin::new(None, None);
|
let cwd_plugin = crate::meta_plugin::cwd::CwdMetaPlugin::new(None, None);
|
||||||
let digest_plugin = crate::meta_plugin::digest::DigestMetaPlugin::new(None, None);
|
let digest_plugin = crate::meta_plugin::digest::DigestMetaPlugin::new(None, None);
|
||||||
let hostname_plugin = crate::meta_plugin::hostname::HostnameMetaPlugin::new(None, None);
|
let hostname_plugin = crate::meta_plugin::hostname::HostnameMetaPlugin::new(None, None);
|
||||||
let magic_file_plugin = crate::meta_plugin::magic::MagicFileMetaPlugin::new(None, None);
|
#[cfg(feature = "magic")]
|
||||||
|
let magic_file_plugin = crate::meta_plugin::magic_file::MagicFileMetaPlugin::new(None, None);
|
||||||
let env_plugin = crate::meta_plugin::env::EnvMetaPlugin::new(None, None);
|
let env_plugin = crate::meta_plugin::env::EnvMetaPlugin::new(None, None);
|
||||||
|
|
||||||
// Create a default configuration
|
// Create a default configuration
|
||||||
@@ -141,6 +142,7 @@ pub fn mode_generate_config(_cmd: &mut Command, _settings: &crate::config::Setti
|
|||||||
options: hostname_plugin.options().clone(),
|
options: hostname_plugin.options().clone(),
|
||||||
outputs: convert_outputs_to_string_map(hostname_plugin.outputs()),
|
outputs: convert_outputs_to_string_map(hostname_plugin.outputs()),
|
||||||
},
|
},
|
||||||
|
#[cfg(feature = "magic")]
|
||||||
MetaPluginConfig {
|
MetaPluginConfig {
|
||||||
name: "magic_file".to_string(),
|
name: "magic_file".to_string(),
|
||||||
options: magic_file_plugin.options().clone(),
|
options: magic_file_plugin.options().clone(),
|
||||||
|
|||||||
Reference in New Issue
Block a user