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

use mullvad_ipc_client::DaemonRpcClient;

pub struct Disconnect;

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

    fn clap_subcommand(&self) -> clap::App<'static, 'static> {
        clap::SubCommand::with_name(self.name())
            .about("Command the client to disconnect the VPN tunnel")
    }

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