Skip to main content

evaluate_detailed

Function evaluate_detailed 

Source
pub fn evaluate_detailed(
    command: &str,
    config: &Config,
) -> DetailedEvaluationResult
Expand description

Evaluate a command with detailed timing and diagnostic information.

This function wraps evaluate_command and captures additional metadata useful for verbose output, debugging, and the dcg test command.

§Arguments

  • command - The raw command string to evaluate
  • config - Loaded configuration with pack settings

§Returns

A DetailedEvaluationResult containing the evaluation result along with timing information, keywords checked, and other diagnostic data.

§Performance

This function has slightly more overhead than evaluate_command due to timing capture and metadata collection. For high-throughput hook mode, prefer evaluate_command or evaluate_command_with_pack_order.

§Example

use destructive_command_guard::evaluator::evaluate_detailed;
use destructive_command_guard::config::Config;

let config = Config::load();
let result = evaluate_detailed("git reset --hard", &config);

if result.is_denied() {
    println!("Command blocked in {}μs", result.evaluation_time_us);
    if let Some(info) = &result.result.pattern_info {
        println!("Blocked by: {:?}", info.pack_id);
    }
}