correctly identify when format is csv

This commit is contained in:
Abraham Toriz 2021-06-30 19:36:08 -05:00
parent fdc45cea3f
commit 52c70d6f66
No known key found for this signature in database
GPG Key ID: D5B4A746DB5DD42A
2 changed files with 3 additions and 1 deletions

View File

@ -36,6 +36,7 @@ impl Formatter {
Formatter::Text => text::print_formatted(entries, out, now, ids, term_width)?,
Formatter::Csv => csv::print_formatted(entries, out, ids)?,
Formatter::Custom(name) => {
panic!("attempted custom formatter with name {} which is not implemented", name);
}
}
@ -51,6 +52,7 @@ impl FromStr for Formatter {
Ok(match &*lower {
"text" => Formatter::Text,
"csv" => Formatter::Csv,
custom_format => Formatter::Custom(custom_format.into()),
})
}

View File

@ -123,7 +123,7 @@ fn main() {
.arg(Arg::with_name("format")
.short("f").long("format")
.takes_value(true).value_name("FORMAT").default_value("text")
.help("The output format. Valid built-in formats are ical, csv, json, ids, factor, and text. Documentation on defining custom formats can be found in the README included in this distribution."))
.help("The output format. Valid built-in formats are ical, csv, json, ids, factor, and text. Documentation on defining custom formats can be found in the README included in this distribution."))
.arg(Arg::with_name("grep")
.short("g").long("grep")
.takes_value(true).value_name("REGEXP")