Switch to a command-line API closer to TaskWarrior

* Use a parser (rather than clap) to process the command line
* Outline some generic support for filtering, reporting, modifying, etc.
* Break argument parsing strictly from invocation, to allow independent testing
This commit is contained in:
Dustin J. Mitchell 2020-12-03 06:58:10 +00:00
parent 87bb829634
commit 2c579b9f01
45 changed files with 1720 additions and 1072 deletions

View file

@ -2,8 +2,8 @@ use assert_cmd::prelude::*;
use predicates::prelude::*;
use std::process::Command;
// This tests that the task binary is running and parsing arguments. The details of subcommands
// are handled with unit tests.
// NOTE: This tests that the task binary is running and parsing arguments. The details of
// subcommands are handled with unit tests.
#[test]
fn help() -> Result<(), Box<dyn std::error::Error>> {
@ -36,7 +36,7 @@ fn invalid_option() -> Result<(), Box<dyn std::error::Error>> {
cmd.arg("--no-such-option");
cmd.assert()
.failure()
.stderr(predicate::str::contains("USAGE"));
.stderr(predicate::str::contains("command line not recognized"));
Ok(())
}