Treat any bare word in the command line as a report name
This commit is contained in:
@@ -4,7 +4,7 @@ pub(crate) mod add;
|
||||
pub(crate) mod gc;
|
||||
pub(crate) mod help;
|
||||
pub(crate) mod info;
|
||||
pub(crate) mod list;
|
||||
pub(crate) mod modify;
|
||||
pub(crate) mod report;
|
||||
pub(crate) mod sync;
|
||||
pub(crate) mod version;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::argparse::Report;
|
||||
use crate::argparse::Filter;
|
||||
use crate::invocation::display_report;
|
||||
use failure::Fallible;
|
||||
use taskchampion::Replica;
|
||||
@@ -7,35 +7,33 @@ use termcolor::WriteColor;
|
||||
pub(crate) fn execute<W: WriteColor>(
|
||||
w: &mut W,
|
||||
replica: &mut Replica,
|
||||
report: Report,
|
||||
report_name: String,
|
||||
filter: Filter,
|
||||
) -> Fallible<()> {
|
||||
display_report(w, replica, &report)
|
||||
display_report(w, replica, report_name, filter)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use crate::argparse::{Column, Filter, Property};
|
||||
use crate::argparse::Filter;
|
||||
use crate::invocation::test::*;
|
||||
use taskchampion::Status;
|
||||
|
||||
#[test]
|
||||
fn test_list() {
|
||||
fn test_report() {
|
||||
let mut w = test_writer();
|
||||
let mut replica = test_replica();
|
||||
replica.new_task(Status::Pending, s!("my task")).unwrap();
|
||||
|
||||
let report = Report {
|
||||
filter: Filter {
|
||||
..Default::default()
|
||||
},
|
||||
columns: vec![Column {
|
||||
label: "Description".to_owned(),
|
||||
property: Property::Description,
|
||||
}],
|
||||
// The function being tested is only one line long, so this is sort of an integration test
|
||||
// for display_report.
|
||||
|
||||
let report_name = "next".to_owned();
|
||||
let filter = Filter {
|
||||
..Default::default()
|
||||
};
|
||||
execute(&mut w, &mut replica, report).unwrap();
|
||||
execute(&mut w, &mut replica, report_name, filter).unwrap();
|
||||
assert!(w.into_string().contains("my task"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user