mirror of
https://github.com/openai/codex.git
synced 2026-05-01 03:42:05 +03:00
introduce variant typing to policy result
This commit is contained in:
@@ -4,6 +4,7 @@ use std::path::Path;
|
||||
use anyhow::Context;
|
||||
use anyhow::Result;
|
||||
use anyhow::bail;
|
||||
use codex_execpolicy2::Evaluation;
|
||||
use codex_execpolicy2::PolicyParser;
|
||||
use codex_execpolicy2::load_default_policy;
|
||||
|
||||
@@ -49,14 +50,14 @@ fn cmd_check(policy_path: Option<String>, args: Vec<String>) -> Result<()> {
|
||||
let policy = load_policy(policy_path)?;
|
||||
|
||||
match policy.evaluate(&args) {
|
||||
Some(eval) => {
|
||||
eval @ Evaluation::Match { .. } => {
|
||||
let json = serde_json::to_string_pretty(&eval)?;
|
||||
println!("{json}");
|
||||
}
|
||||
None => {
|
||||
Evaluation::NoMatch => {
|
||||
println!("no match");
|
||||
}
|
||||
}
|
||||
};
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user