use clap::Parser;
#[derive(Debug, Parser)]
#[clap(version, about, author)]
pub struct NautilusCli {
#[clap(subcommand)]
pub command: Commands,
}
#[derive(Parser, Debug)]
pub enum Commands {
Database(DatabaseOpt),
#[cfg(feature = "defi")]
Blockchain(BlockchainOpt),
}
#[derive(Parser, Debug)]
#[command(about = "Postgres database operations", long_about = None)]
pub struct DatabaseOpt {
#[clap(subcommand)]
pub command: DatabaseCommand,
}
#[derive(Parser, Debug, Clone)]
pub struct DatabaseConfig {
#[arg(long)]
pub host: Option<String>,
#[arg(long)]
pub port: Option<u16>,
#[arg(long)]
pub username: Option<String>,
#[arg(long)]
pub database: Option<String>,
#[arg(long)]
pub password: Option<String>,
#[arg(long)]
pub schema: Option<String>,
}
#[derive(Parser, Debug, Clone)]
#[command(about = "Postgres database operations", long_about = None)]
pub enum DatabaseCommand {
Init(DatabaseConfig),
Drop(DatabaseConfig),
}
#[cfg(feature = "defi")]
#[derive(Parser, Debug)]
#[command(about = "Blockchain operations", long_about = None)]
pub struct BlockchainOpt {
#[clap(subcommand)]
pub command: BlockchainCommand,
}
#[cfg(feature = "defi")]
#[derive(Parser, Debug, Clone)]
#[command(about = "Blockchain operations", long_about = None)]
pub enum BlockchainCommand {
SyncBlocks {
#[arg(long)]
chain: String,
#[arg(long)]
from_block: Option<u64>,
#[arg(long)]
to_block: Option<u64>,
#[clap(flatten)]
database: DatabaseConfig,
},
SyncDex {
#[arg(long)]
chain: String,
#[arg(long)]
dex: String,
#[arg(long)]
rpc_url: Option<String>,
#[arg(long)]
reset: bool,
#[arg(long)]
multicall_calls_per_rpc_request: Option<u32>,
#[clap(flatten)]
database: DatabaseConfig,
},
AnalyzePool {
#[arg(long)]
chain: String,
#[arg(long)]
dex: String,
#[arg(long)]
address: String,
#[arg(long)]
from_block: Option<u64>,
#[arg(long)]
to_block: Option<u64>,
#[arg(long)]
rpc_url: Option<String>,
#[arg(long)]
reset: bool,
#[arg(long)]
multicall_calls_per_rpc_request: Option<u32>,
#[clap(flatten)]
database: DatabaseConfig,
},
}