changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / rust/bin/mailman/main.rs

changeset 698: 96958d3eb5b0
parent: 94d358919982
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 use clap::{Parser, Subcommand};
2 use logger::{trace, Logger};
3 // use obj::Objective;
4 use std::path::PathBuf;
5 use util::{cli::log_level_str_from_cli, Result};
6 // use jmap_client::{client::Client, core::query::Filter, email, mailbox};
7 
8 #[derive(Debug, Parser)]
9 #[command(name="mailman",author, version, about, long_about = None)]
10 struct Cli {
11  /// Command to run
12  #[command(subcommand)]
13  cmd: Option<Cmd>,
14  /// Set the default config file
15  #[arg(short, long, env = "MAILMAN_CONFIG_FILE")]
16  cfg: Option<PathBuf>,
17  /// Set a user for this command
18  #[arg(short, long, env = "USER")]
19  user: Option<String>,
20  /// Set log level
21  #[arg(short, long, action = clap::ArgAction::Count)]
22  level: u8,
23 }
24 
25 #[derive(Subcommand, Debug)]
26 enum Cmd {
27  /// Ping the server
28  Ping,
29  /// Search for items
30  Search,
31  /// Import an account
32  Import,
33  /// Export an account
34  Export,
35 }
36 
37 #[tokio::main]
38 async fn main() -> Result<()> {
39  // parse args
40  let args = Cli::parse();
41  // init logger
42  Logger::try_with_str(log_level_str_from_cli(args.level))?.start()?;
43  trace!("{:?}", args);
44  // load config
45 
46  let args = Cli::parse();
47  println!("{:?}", args.cmd);
48  Ok(())
49 }