nyx/src/commands/mod.rs
elipeter 80c0bc9845 Add max_file_size_mb and high_only logic to scanning process:
- Implement `max_file_size_mb` to restrict files for scanning based on size.
- Refactor `high_only` handling to modify `min_severity` in `Config`.
- Update `ScannerConfig` to use `Option<u64>` for optional size limits.
- Remove redundant `high_only` parameter from `scan::handle` function.
- Improve batch processing in `walk` for efficient file scanning.
2025-06-23 16:51:39 +02:00

32 lines
No EOL
920 B
Rust

pub mod scan;
pub mod index;
pub mod list;
pub mod clean;
use crate::cli::Commands;
use std::path::Path;
use crate::patterns::Severity;
use crate::utils::config::Config;
pub fn handle_command(
command: Commands,
database_dir: &Path,
config: &mut Config
) -> Result<(), Box<dyn std::error::Error>> {
match command {
Commands::Scan { path, no_index, rebuild_index, format, high_only } => {
if high_only { config.scanner.min_severity = Severity::High };
scan::handle(&path, no_index, rebuild_index, format, database_dir, config)
}
Commands::Index { action } => {
index::handle(action, database_dir, config)
}
Commands::List { verbose } => {
list::handle(verbose, database_dir)
}
Commands::Clean { project, all } => {
clean::handle(project, all, database_dir)
}
}
}