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:
27
cli/src/argparse/mod.rs
Normal file
27
cli/src/argparse/mod.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
/*!
|
||||
|
||||
This module is responsible for parsing command lines (`Arglist`, an alias for `&[&str]`) into `Command` instances.
|
||||
It removes some redundancy from the command line, for example combining the multiple ways to modify a task into a single `Modification` struct.
|
||||
|
||||
The module is organized as a nom parser over ArgList, and each struct has a `parse` method to parse such a list.
|
||||
|
||||
The exception to this rule is the `args` sub-module, which contains string parsers that are applied to indivdual command-line elements.
|
||||
|
||||
All of the structs produced by this module are fully-owned, data-only structs.
|
||||
That is, they contain no references, and have no methods to aid in their execution -- that is the `invocation` module's job.
|
||||
|
||||
*/
|
||||
mod args;
|
||||
mod command;
|
||||
mod filter;
|
||||
mod modification;
|
||||
mod report;
|
||||
mod subcommand;
|
||||
|
||||
pub(crate) use command::Command;
|
||||
pub(crate) use filter::Filter;
|
||||
pub(crate) use modification::{DescriptionMod, Modification};
|
||||
pub(crate) use report::Report;
|
||||
pub(crate) use subcommand::Subcommand;
|
||||
|
||||
type ArgList<'a> = &'a [&'a str];
|
||||
Reference in New Issue
Block a user