summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli/src/cmds/shutdown.rs
blob: f56ba0a9729c5b8428486faa22cca3fd244beed7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use clap;
use {Command, Result};

use mullvad_ipc_client::DaemonRpcClient;

pub struct Shutdown;

impl Command for Shutdown {
    fn name(&self) -> &'static str {
        "shutdown"
    }

    fn clap_subcommand(&self) -> clap::App<'static, 'static> {
        clap::SubCommand::with_name(self.name()).about("Makes the backend daemon quit")
    }

    fn run(&self, _matches: &clap::ArgMatches) -> Result<()> {
        let mut rpc = DaemonRpcClient::new()?;
        rpc.shutdown()?;
        Ok(())
    }
}