summaryrefslogtreecommitdiffhomepage
path: root/talpid_cli
diff options
context:
space:
mode:
Diffstat (limited to 'talpid_cli')
-rw-r--r--talpid_cli/src/cli.rs66
-rw-r--r--talpid_cli/src/main.rs18
2 files changed, 50 insertions, 34 deletions
diff --git a/talpid_cli/src/cli.rs b/talpid_cli/src/cli.rs
index 79a13d94c2..b61c4112b5 100644
--- a/talpid_cli/src/cli.rs
+++ b/talpid_cli/src/cli.rs
@@ -1,4 +1,4 @@
-use clap::{Arg, App, ArgMatches};
+use clap::{App, Arg, ArgMatches};
use std::path::PathBuf;
use talpid_core::net::RemoteAddr;
@@ -41,30 +41,42 @@ fn create_app() -> App<'static, 'static> {
.version(crate_version!())
.author(crate_authors!())
.about(crate_description!())
- .arg(Arg::with_name("openvpn")
- .long("openvpn")
- .help("Specify what OpenVPN binary to run")
- .default_value("/usr/sbin/openvpn"))
- .arg(Arg::with_name("config")
- .short("c")
- .long("config")
- .help("Specify what config file to start OpenVPN with")
- .default_value("./openvpn.conf"))
- .arg(Arg::with_name("remotes")
- .short("r")
- .long("remotes")
- .help("Configure what remote(s) to connect to. Accepts anything OpenVPN can use. \
- Format: <address>:<port>")
- .takes_value(true)
- .multiple(true)
- .required(true))
- .arg(Arg::with_name("plugin")
- .long("plugin")
- .help("Path to talpid plugin")
- .default_value(DEFAULT_PLUGIN_PATH))
- .arg(Arg::with_name("verbose")
- .short("v")
- .long("verbose")
- .multiple(true)
- .help("Sets the level of verbosity"))
+ .arg(
+ Arg::with_name("openvpn")
+ .long("openvpn")
+ .help("Specify what OpenVPN binary to run")
+ .default_value("/usr/sbin/openvpn"),
+ )
+ .arg(
+ Arg::with_name("config")
+ .short("c")
+ .long("config")
+ .help("Specify what config file to start OpenVPN with")
+ .default_value("./openvpn.conf"),
+ )
+ .arg(
+ Arg::with_name("remotes")
+ .short("r")
+ .long("remotes")
+ .help(
+ "Configure what remote(s) to connect to. Accepts anything OpenVPN can use. \
+ Format: <address>:<port>",
+ )
+ .takes_value(true)
+ .multiple(true)
+ .required(true),
+ )
+ .arg(
+ Arg::with_name("plugin")
+ .long("plugin")
+ .help("Path to talpid plugin")
+ .default_value(DEFAULT_PLUGIN_PATH),
+ )
+ .arg(
+ Arg::with_name("verbose")
+ .short("v")
+ .long("verbose")
+ .multiple(true)
+ .help("Sets the level of verbosity"),
+ )
}
diff --git a/talpid_cli/src/main.rs b/talpid_cli/src/main.rs
index e07a8126a7..0a857e05d3 100644
--- a/talpid_cli/src/main.rs
+++ b/talpid_cli/src/main.rs
@@ -39,7 +39,8 @@ pub fn init_logger() -> Result<()> {
fn create_openvpn_command(args: &Args) -> OpenVpnCommand {
let mut command = OpenVpnCommand::new(&args.binary);
- command.config(&args.config)
+ command
+ .config(&args.config)
.remotes(&args.remotes[..])
.unwrap()
.pipe_output(args.verbosity > 0);
@@ -70,12 +71,15 @@ fn start_monitor(monitor: &mut OpenVpnMonitor)
-> StdResult<Receiver<OpenVpnEvent>, openvpn::Error> {
let (tx, rx) = mpsc::channel();
let callback = move |clean| tx.send(clean).unwrap();
- monitor.start(callback)
- .map(|(stdout, stderr)| {
- stdout.map(|stream| pass_io(stream, io::stdout()));
- stderr.map(|stream| pass_io(stream, io::stderr()));
- rx
- })
+ monitor
+ .start(callback)
+ .map(
+ |(stdout, stderr)| {
+ stdout.map(|stream| pass_io(stream, io::stdout()));
+ stderr.map(|stream| pass_io(stream, io::stderr()));
+ rx
+ },
+ )
}
fn pass_io<I, O>(mut input: I, mut output: O)