This repository has been archived on 2024-06-08. You can view files and clone it, but cannot push or open issues or pull requests.
powd/src/cli.rs

46 lines
1.1 KiB
Rust

use clap::Parser;
use crate::avg::AvgGenerate;
use crate::diff::ForDiff;
use crate::gen::GenerateDeriveArgs;
use crate::migrate_pg::SledToPostgres;
use crate::print::PrintRes;
#[derive(Parser)] // requires `derive` feature
#[command(name = "cargo")]
#[command(bin_name = "cargo")]
pub enum PoWdCli {
Generate(GenerateDeriveArgs),
PrintDB(PrintRes),
SledToPostgres(SledToPostgres),
ForDiff(ForDiff),
AvgGenerate(AvgGenerate),
}
impl PoWdCli {
pub async fn run() {
match PoWdCli::parse() {
PoWdCli::Generate(args) => {
println!("{:?}", args);
args.run();
}
PoWdCli::PrintDB(args) => {
println!("{:?}", args);
args.run()
}
PoWdCli::SledToPostgres(args) => {
args.run().await;
}
PoWdCli::ForDiff(args) => {
println!("{:?}", args);
args.run();
}
PoWdCli::AvgGenerate(args) => {
args.run().await;
}
}
}
}