use std::path::PathBuf; use clap::{Parser, Subcommand}; #[derive(Parser)] #[clap(author, version, about, long_about = None)] pub(crate) struct Cli { #[clap(subcommand)] pub command: Command, } #[derive(Subcommand)] pub(crate) enum Command { /// Fetch emails from an IMAP server FetchFromImap { #[clap(short, long, value_parser)] server: String, #[clap(long, value_parser, default_value_t = 993)] port: u16, #[clap(short, long, value_parser)] username: String, #[clap(short, long, value_parser)] password: String, }, /// Fetch an email from a .eml file FetchFromFile { #[clap(value_parser)] filename: PathBuf, }, /// Build an ATOM feed containing the full contents of the email BuildFeed { /// Host name hosting the feed hostname: String, /// Feed file #[clap(value_parser, default_value = "output/feed.xml")] filename: PathBuf, /// Create an HTML file for each message #[clap(short, long, value_parser, default_value_t = false)] include_html: bool, }, /// Exports the emails as HTML files ExportHtml { /// The directory in which the emails will be stored #[clap(value_parser, default_value = "output/")] directory: PathBuf, }, /// Fetches and exports all mails from an IMAP mailbox. Requires configuration FetchAndExport { /// The directory in which the output will be stored #[clap(value_parser, default_value = "output/")] directory: PathBuf, }, /// Update to the latest version Update, }