summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs
index 171fe3c..8edc760 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -9,6 +9,7 @@ extern crate failure;
9extern crate clap; 9extern crate clap;
10extern crate clap_log_flag; 10extern crate clap_log_flag;
11extern crate clap_verbosity_flag; 11extern crate clap_verbosity_flag;
12#[macro_use]
12extern crate structopt; 13extern crate structopt;
13 14
14mod dbus_api; 15mod dbus_api;
@@ -109,7 +110,17 @@ impl Filter {
109 } 110 }
110} 111}
111 112
112fn main() -> Result<(), Error> { 113fn main() {
114 match start() {
115 Ok(()) => (),
116 Err(err) => {
117 eprintln!("Error: {}", err);
118 std::process::exit(-1);
119 }
120 }
121}
122
123fn start() -> Result<(), Error> {
113 let args = Cli::from_args(); 124 let args = Cli::from_args();
114 args.log.log_all(args.verbose.log_level())?; 125 args.log.log_all(args.verbose.log_level())?;
115 126
@@ -142,8 +153,8 @@ fn load(args: LoadCli) -> Result<(), Error> {
142 153
143 let filter = if args.file == "-" { 154 let filter = if args.file == "-" {
144 let stdin = io::stdin(); 155 let stdin = io::stdin();
145 let mut lock = stdin.lock(); 156 let mut handle = stdin.lock();
146 read_filter(&mut lock)? 157 read_filter(&mut handle)?
147 } else { 158 } else {
148 let mut file = File::open(args.file)?; 159 let mut file = File::open(args.file)?;
149 read_filter(&mut file)? 160 read_filter(&mut file)?