zeta eval: --repeat flag (#42569)
Adds a `--repeat` flag to the zeta eval that runs each example as many times as specified. Also makes the output nicer in a few ways. Release Notes: - N/A --------- Co-authored-by: Ben Kunkle <ben@zed.dev> Co-authored-by: Michael <michael@zed.dev>
This commit is contained in:
co-authored by
Ben Kunkle
Michael
parent
f2a1eb9963
commit
b0700a4625
@@ -35,8 +35,10 @@ use crate::util::{open_buffer, open_buffer_with_language_server};
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(name = "zeta")]
|
||||
struct ZetaCliArgs {
|
||||
#[arg(long, default_value_t = false)]
|
||||
printenv: bool,
|
||||
#[command(subcommand)]
|
||||
command: Command,
|
||||
command: Option<Command>,
|
||||
}
|
||||
|
||||
#[derive(Subcommand, Debug)]
|
||||
@@ -413,14 +415,22 @@ fn main() {
|
||||
let app_state = Arc::new(headless::init(cx));
|
||||
cx.spawn(async move |cx| {
|
||||
match args.command {
|
||||
Command::Zeta1 {
|
||||
None => {
|
||||
if args.printenv {
|
||||
::util::shell_env::print_env();
|
||||
return;
|
||||
} else {
|
||||
panic!("Expected a command");
|
||||
}
|
||||
}
|
||||
Some(Command::Zeta1 {
|
||||
command: Zeta1Command::Context { context_args },
|
||||
} => {
|
||||
}) => {
|
||||
let context = zeta1_context(context_args, &app_state, cx).await.unwrap();
|
||||
let result = serde_json::to_string_pretty(&context.body).unwrap();
|
||||
println!("{}", result);
|
||||
}
|
||||
Command::Zeta2 { command } => match command {
|
||||
Some(Command::Zeta2 { command }) => match command {
|
||||
Zeta2Command::Predict(arguments) => {
|
||||
run_zeta2_predict(arguments, &app_state, cx).await;
|
||||
}
|
||||
@@ -464,14 +474,16 @@ fn main() {
|
||||
println!("{}", result.unwrap());
|
||||
}
|
||||
},
|
||||
Command::ConvertExample {
|
||||
Some(Command::ConvertExample {
|
||||
path,
|
||||
output_format,
|
||||
} => {
|
||||
}) => {
|
||||
let example = NamedExample::load(path).unwrap();
|
||||
example.write(output_format, io::stdout()).unwrap();
|
||||
}
|
||||
Command::Clean => std::fs::remove_dir_all(&*crate::paths::TARGET_ZETA_DIR).unwrap(),
|
||||
Some(Command::Clean) => {
|
||||
std::fs::remove_dir_all(&*crate::paths::TARGET_ZETA_DIR).unwrap()
|
||||
}
|
||||
};
|
||||
|
||||
let _ = cx.update(|cx| cx.quit());
|
||||
|
||||
Reference in New Issue
Block a user