'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
Gc,
Sync,
Import,
ImportTW,
ImportTDB2 {
path: String,
},
@ -77,7 +77,7 @@ impl Subcommand {
Info::parse,
Gc::parse,
Sync::parse,
Import::parse,
ImportTW::parse,
ImportTDB2::parse,
Undo::parse,
// This must come last since it accepts arbitrary report names
@ -94,7 +94,7 @@ impl Subcommand {
Info::get_usage(u);
Gc::get_usage(u);
Sync::get_usage(u);
Import::get_usage(u);
ImportTW::get_usage(u);
ImportTDB2::get_usage(u);
Undo::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 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) {
u.subcommands.push(usage::Subcommand {
name: "import",
syntax: "import",
summary: "Import tasks",
name: "import-tw",
syntax: "import-tw",
summary: "Import tasks from TaskWarrior export",
description: "
Import tasks into this replica.

View file

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

View file

@ -91,10 +91,10 @@ pub(crate) fn invoke(command: Command, settings: Settings) -> Result<(), crate::
}
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 {