1use crate::{
3 config::GitMoverConfig, errors::GitMoverError, platform::PlatformType, utils::main_sync,
4};
5use clap::Parser;
6use serde::Deserialize;
7use std::path::PathBuf;
8
9#[derive(Parser, Deserialize, Default, Clone, Debug)]
11pub struct GitMoverCli {
12 #[arg(long, visible_alias = "from")]
14 pub source: Option<PlatformType>,
15
16 #[arg(long, visible_alias = "to")]
18 pub destination: Option<PlatformType>,
19
20 #[arg(long = "no-forks")]
22 pub no_forks: bool,
23
24 #[arg(long = "no-delete")]
26 pub no_delete: bool,
27
28 #[arg(long)]
30 pub resync: bool,
31
32 #[arg(long)]
34 pub config: Option<PathBuf>,
35
36 #[arg(long)]
38 pub show_config_path: bool,
39
40 #[arg(long)]
42 pub manual: bool,
43
44 #[arg(short, long, visible_short_alias = 'd', action = clap::ArgAction::Count)]
46 pub verbose: u8,
47}
48
49impl GitMoverCli {
50 pub async fn main(self) -> Result<(), GitMoverError> {
54 let config = GitMoverConfig::try_new(self)?;
55 if config.cli_args.show_config_path {
56 println!("{}", config.config_path.display());
57 return Ok(());
58 }
59 main_sync(config).await
60 }
61}
62
63pub async fn git_mover_main() -> Result<(), GitMoverError> {
67 let git_mover_inst = GitMoverCli::parse();
68 git_mover_inst.main().await
69}