use crate::{defaults, ops::forc_index_deploy};
use anyhow::Result;
use clap::Parser;
use std::path::PathBuf;
#[derive(Debug, Parser)]
pub struct Command {
#[clap(long, default_value = defaults::INDEXER_SERVICE_HOST, help = "URL at which to deploy indexer assets.")]
pub url: String,
#[clap(
short,
long,
help = "Path to the manifest of indexer project being deployed."
)]
pub manifest: Option<String>,
#[clap(short, long, help = "Path to the indexer project.")]
pub path: Option<PathBuf>,
#[clap(long, help = "Authentication header value.")]
pub auth: Option<String>,
#[clap(
short,
long,
help = "Build optimized artifacts with the debug profile."
)]
pub debug: bool,
#[clap(long, help = "Ensure that the Cargo.lock file is up-to-date.")]
pub locked: bool,
#[clap(short, long, help = "Enable verbose logging.")]
pub verbose: bool,
#[clap(long, help = "Do not build before deploying.")]
pub skip_build: bool,
#[clap(long, help = "If an indexer with the same UID exists, remove it.")]
pub replace_indexer: bool,
#[clap(
long,
help = "Remove all indexed data when replacing an existing indexer."
)]
pub remove_data: bool,
}
pub async fn exec(command: Command) -> Result<()> {
forc_index_deploy::init(command).await?;
Ok(())
}