1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use crate::{defaults, ops::forc_index_remove};
use anyhow::Result;
use clap::Parser;
use std::path::PathBuf;

/// Stop and remove a running indexer.
#[derive(Debug, Parser)]
pub struct Command {
    /// URL at which indexer is deployed.
    #[clap(long, default_value = defaults::INDEXER_SERVICE_HOST, help = "URL at which indexer is deployed.")]
    pub url: String,

    /// Path to the manifest of the indexer project being removed.
    #[clap(
        short,
        long,
        help = "Path to the manifest of the indexer project being removed."
    )]
    pub manifest: Option<String>,

    /// Path of indexer project.
    #[clap(short, long, help = "Path to the indexer project.")]
    pub path: Option<PathBuf>,

    /// Authentication header value.
    #[clap(long, help = "Authentication header value.")]
    pub auth: Option<String>,

    /// Enable verbose output.
    #[clap(short, long, help = "Enable verbose output.")]
    pub verbose: bool,
}

pub async fn exec(command: Command) -> Result<()> {
    forc_index_remove::init(command).await?;
    Ok(())
}