Change output to not have quotes when printing string, int, float or bool
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
parent
eb85635bef
commit
a6bbcd65f4
1 changed files with 19 additions and 4 deletions
|
@ -47,10 +47,12 @@ extern crate libimagutil;
|
|||
|
||||
use std::io::Write;
|
||||
use std::str::FromStr;
|
||||
use std::string::ToString;
|
||||
|
||||
use clap::ArgMatches;
|
||||
use filters::filter::Filter;
|
||||
use failure::Error;
|
||||
use toml::Value;
|
||||
|
||||
use libimagerror::exit::ExitCode;
|
||||
use libimagerror::exit::ExitUnwrap;
|
||||
|
@ -134,7 +136,20 @@ fn read<'a, 'e, I>(rt: &Runtime, mtch: &ArgMatches<'a>, iter: I) -> i32
|
|||
.map_err_trace_exit_unwrap()
|
||||
.map(|value| {
|
||||
trace!("Processing headers: Got value {:?}", value);
|
||||
|
||||
let string_representation = match value {
|
||||
Value::String(s) => Some(s.to_owned()),
|
||||
Value::Integer(i) => Some(i.to_string()),
|
||||
Value::Float(f) => Some(f.to_string()),
|
||||
Value::Boolean(b) => Some(b.to_string()),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
if let Some(repr) = string_representation {
|
||||
writeln!(output, "{}", repr)
|
||||
} else {
|
||||
writeln!(output, "{}", value)
|
||||
}
|
||||
.to_exit_code()
|
||||
.map(|_| accu)
|
||||
.unwrap_or_else(ExitCode::code)
|
||||
|
|
Loading…
Reference in a new issue