use clap::Parser;
const VERSION_STRING: &str = concat!(
env!("CARGO_PKG_VERSION"),
", revision ",
include!(concat!(env!("OUT_DIR"), "/version_fragment.rs")),
);
#[derive(Debug, Parser)]
#[command(
name = "influxdb3-plugin",
version = VERSION_STRING,
about = "Author-side tooling for InfluxDB 3 plugins.",
long_about = None,
)]
pub struct PluginConfig {
#[command(subcommand)]
command: Command,
}
#[derive(Debug, clap::Subcommand)]
enum Command {
#[command(subcommand)]
New(crate::commands::new::NewCommand),
Search(crate::commands::index::SearchArgs),
Info(crate::commands::index::InfoArgs),
Validate(crate::commands::validate::Args),
Package(crate::commands::package::Args),
Yank(crate::commands::yank::Args),
}
impl PluginConfig {
pub async fn run(self) -> anyhow::Result<()> {
match self.command {
Command::New(sub) => sub.run(),
Command::Search(args) => args.run(),
Command::Info(args) => args.run(),
Command::Validate(args) => args.run(),
Command::Package(args) => args.run(),
Command::Yank(args) => args.run(),
}
}
}