summaryrefslogtreecommitdiffstats
path: root/bin/domain/imag-mail/src/ui.rs
diff options
context:
space:
mode:
Diffstat (limited to 'bin/domain/imag-mail/src/ui.rs')
-rw-r--r--bin/domain/imag-mail/src/ui.rs92
1 files changed, 24 insertions, 68 deletions
diff --git a/bin/domain/imag-mail/src/ui.rs b/bin/domain/imag-mail/src/ui.rs
index 324fabb4..eecb4020 100644
--- a/bin/domain/imag-mail/src/ui.rs
+++ b/bin/domain/imag-mail/src/ui.rs
@@ -28,98 +28,54 @@ use clap::{Arg, ArgMatches, App, SubCommand};
pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
app
- .subcommand(SubCommand::with_name("import-mail")
- .about("Import a mail (create a reference to it) (Maildir)")
- .version("0.1")
- .arg(Arg::with_name("ignore-existing-ids")
- .long("ignore-existing")
- .short("I")
- .takes_value(false)
- .required(false)
- .help("Ignore errors that might occur when store entries exist already"))
- .arg(Arg::with_name("path")
- .index(1)
- .takes_value(true)
- .multiple(true)
- .required(true)
- .help("Path to the mail file(s) to import")
- .value_name("PATH"))
- )
+ .arg(Arg::with_name("database_path")
+ .long("db")
+ .takes_value(true)
+ .required(false)
+ .value_name("PATH")
+ .help("The path to the notmuch database to use (defaults to value in config)"))
- .subcommand(SubCommand::with_name("scan")
- .about("Scan a directory for mails")
+ .subcommand(SubCommand::with_name("import")
+ .about("Import mails from notmuch")
.version("0.1")
- .arg(Arg::with_name("ignore-existing-ids")
- .long("ignore-existing")
- .short("I")
- .takes_value(false)
- .required(false)
- .help("Ignore errors that might occur when store entries exist already"))
-
- .arg(Arg::with_name("scan-parallel")
- .long("parallel")
- .takes_value(false)
- .required(false)
- .multiple(false)
- .help("Scan with multiple threads. Might be faster, but might slow down other tasks"))
-
- .arg(Arg::with_name("path")
+ .arg(Arg::with_name("query")
.index(1)
.takes_value(true)
- .multiple(true)
.required(true)
- .validator(libimagutil::cli_validators::is_directory)
- .value_name("DIR")
- .help("Path to the directory containing mails"))
+ .value_name("QUERY")
+ .help("Imports mails from notmuch to imag, using a query to fetch mails to import"))
)
.subcommand(SubCommand::with_name("list")
- .about("List all stored references to mails")
+ .about("List mails in imag")
.version("0.1")
-
- .arg(Arg::with_name("list-id")
+ .arg(Arg::with_name("query")
.index(1)
.takes_value(true)
.required(false)
- .multiple(true)
- .help("The ids of the mails to list information for"))
-
- .arg(Arg::with_name("format")
- .long("format")
- .takes_value(true)
- .required(false)
- .multiple(false)
- .help("The format to list the mails with"))
+ .value_name("QUERY")
+ .help("List Store IDs for mails in imag, using a query to ask notmuch for the mails"))
)
- .subcommand(SubCommand::with_name("unread")
- .about("Show unread mail")
+ .subcommand(SubCommand::with_name("print-id")
+ .about("Print id of mail(s)")
.version("0.1")
-
- .arg(Arg::with_name("unread-read")
- .long("read")
- .short("r")
- .takes_value(false)
+ .arg(Arg::with_name("ID")
+ .index(1)
+ .takes_value(true)
+ .multiple(true)
.required(false)
- .multiple(false)
- .help("Print the textual content of the mail itself as well"))
+ .value_name("ID")
+ .help("Print ID of mail(s) identified by Store ID(s)"))
)
- .subcommand(SubCommand::with_name("mail-store")
- .about("Operations on (subsets of) all mails")
- .version("0.1")
- .subcommand(SubCommand::with_name("update-refs")
- .about("Create references based on Message-IDs for all loaded mails")
- .version("0.1"))
- // TODO: We really should be able to filter here.
- )
}
pub struct PathProvider;
impl IdPathProvider for PathProvider {
fn get_ids(matches: &ArgMatches) -> Result<Option<Vec<StoreId>>> {
- matches.values_of("list-id")
+ matches.values_of("ID")
.map(|v| v
.map(PathBuf::from)
.map(|pb| pb.into_storeid())