1use crate::{config::Config, platform::PlatformType, utils::main_sync};
3use clap::Parser;
4use serde::Deserialize;
5use std::path::PathBuf;
6
7#[derive(Parser, Deserialize, Default, Clone, Debug)]
9pub struct GitMoverCli {
10 #[arg(short, long, visible_alias = "from")]
12 pub source: Option<PlatformType>,
13
14 #[arg(short, long, visible_alias = "to")]
16 pub destination: Option<PlatformType>,
17
18 #[arg(short, long = "no-forks")]
20 pub no_forks: bool,
21
22 #[arg(short, long)]
24 pub resync: bool,
25
26 #[arg(short, long)]
28 pub config: Option<String>,
29
30 #[arg(long)]
32 pub show_config_path: bool,
33
34 #[arg(short, long)]
36 pub manual: bool,
37
38 #[arg(short, long, action = clap::ArgAction::Count)]
40 pub verbose: u8,
41}
42
43pub async fn cli_main() {
45 let args = GitMoverCli::parse();
46 let config_path = args.config.clone();
47 let mut config = match config_path {
48 Some(path_str) => {
49 let path = PathBuf::from(path_str);
50 Config::new_from_path(args, &path)
51 }
52 None => Config::new(args),
53 };
54 if config.cli_args.show_config_path {
55 println!("{}", config.config_path.display());
56 return;
57 }
58 main_sync(&mut config).await;
59}