Make commands common

This commit is contained in:
Mubelotix
2025-08-25 12:07:27 +02:00
parent 3a2ec5f576
commit 72b6b73a91
6 changed files with 36 additions and 18 deletions

View File

@ -1,6 +1,9 @@
use cargo_metadata::semver::Version;
use clap::Parser;
use serde::Deserialize;
use crate::common::{args::CommonArgs, logs::setup_logs};
use crate::common::command::Command;
use crate::common::{args::CommonArgs, client::Client, logs::setup_logs};
mod workload;
@ -12,10 +15,26 @@ pub struct TestDeriveArgs {
/// Common arguments shared with other commands
#[command(flatten)]
common: CommonArgs,
initial_version: Version,
}
#[derive(Deserialize)]
#[serde(untagged)]
pub enum CommandOrUpgrade {
Command(Command),
Upgrade { upgrade: Version },
}
pub fn run(args: TestDeriveArgs) -> anyhow::Result<()> {
setup_logs(&args.common.log_filter)?;
// setup clients
let assets_client = Client::new(
None,
args.common.assets_key.as_deref(),
Some(std::time::Duration::from_secs(3600)), // 1h
)?;
Ok(())
}