1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
use crate::{defaults, ops::forc_index_kill};
use clap::Parser;

/// Kill the indexer process. Note that this command will kill any process
/// listening on the default indexer port or the port specified by the `--port` flag.
#[derive(Debug, Parser)]
pub struct Command {
    /// Port on which the process is listening.
    #[clap(long, default_value = defaults::WEB_API_PORT, help = "Port at which to detect indexer service API is running.")]
    pub port: String,
    /// Terminate or kill.
    #[clap(short = '9')]
    pub kill: bool,
}

pub fn exec(command: Command) -> anyhow::Result<()> {
    forc_index_kill::kill(command)?;
    Ok(())
}