'ta import' -> 'ta import-tw'

This commit is contained in:
Dustin J. Mitchell 2022-01-23 15:27:13 +00:00
parent 656f7e9ea0
commit 210eb60c86
4 changed files with 13 additions and 13 deletions

View file

@ -59,7 +59,7 @@ pub(crate) enum Subcommand {
/// Basic operations without args /// Basic operations without args
Gc, Gc,
Sync, Sync,
Import, ImportTW,
ImportTDB2 { ImportTDB2 {
path: String, path: String,
}, },
@ -77,7 +77,7 @@ impl Subcommand {
Info::parse, Info::parse,
Gc::parse, Gc::parse,
Sync::parse, Sync::parse,
Import::parse, ImportTW::parse,
ImportTDB2::parse, ImportTDB2::parse,
Undo::parse, Undo::parse,
// This must come last since it accepts arbitrary report names // This must come last since it accepts arbitrary report names
@ -94,7 +94,7 @@ impl Subcommand {
Info::get_usage(u); Info::get_usage(u);
Gc::get_usage(u); Gc::get_usage(u);
Sync::get_usage(u); Sync::get_usage(u);
Import::get_usage(u); ImportTW::get_usage(u);
ImportTDB2::get_usage(u); ImportTDB2::get_usage(u);
Undo::get_usage(u); Undo::get_usage(u);
Report::get_usage(u); Report::get_usage(u);
@ -433,21 +433,21 @@ impl Sync {
} }
} }
struct Import; struct ImportTW;
impl Import { impl ImportTW {
fn parse(input: ArgList) -> IResult<ArgList, Subcommand> { fn parse(input: ArgList) -> IResult<ArgList, Subcommand> {
fn to_subcommand(_: &str) -> Result<Subcommand, ()> { fn to_subcommand(_: &str) -> Result<Subcommand, ()> {
Ok(Subcommand::Import) Ok(Subcommand::ImportTW)
} }
map_res(arg_matching(literal("import")), to_subcommand)(input) map_res(arg_matching(literal("import-tw")), to_subcommand)(input)
} }
fn get_usage(u: &mut usage::Usage) { fn get_usage(u: &mut usage::Usage) {
u.subcommands.push(usage::Subcommand { u.subcommands.push(usage::Subcommand {
name: "import", name: "import-tw",
syntax: "import", syntax: "import-tw",
summary: "Import tasks", summary: "Import tasks from TaskWarrior export",
description: " description: "
Import tasks into this replica. Import tasks into this replica.

View file

@ -4,8 +4,8 @@ pub(crate) mod add;
pub(crate) mod config; pub(crate) mod config;
pub(crate) mod gc; pub(crate) mod gc;
pub(crate) mod help; pub(crate) mod help;
pub(crate) mod import;
pub(crate) mod import_tdb2; pub(crate) mod import_tdb2;
pub(crate) mod import_tw;
pub(crate) mod info; pub(crate) mod info;
pub(crate) mod modify; pub(crate) mod modify;
pub(crate) mod report; pub(crate) mod report;

View file

@ -91,10 +91,10 @@ pub(crate) fn invoke(command: Command, settings: Settings) -> Result<(), crate::
} }
Command { Command {
subcommand: Subcommand::Import, subcommand: Subcommand::ImportTW,
.. ..
} => { } => {
return cmd::import::execute(&mut w, &mut replica); return cmd::import_tw::execute(&mut w, &mut replica);
} }
Command { Command {