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#[allow(clippy::struct_excessive_bools)]
11#[derive(Parser, Deserialize, Default, Clone, Debug)]
12pub struct GitMoverCli {
13 #[arg(long, visible_alias = "from")]
15 pub source: Option<PlatformType>,
16
17 #[arg(long, alias = "dest", visible_alias = "to")]
19 pub destination: Option<PlatformType>,
20
21 #[arg(long = "no-forks")]
23 pub no_forks: bool,
24
25 #[arg(long = "no-delete")]
27 pub no_delete: bool,
28
29 #[arg(long)]
31 pub resync: bool,
32
33 #[arg(long)]
35 pub config: Option<PathBuf>,
36
37 #[arg(long)]
39 pub show_config_path: bool,
40
41 #[arg(long)]
43 pub manual: bool,
44
45 #[arg(short, long, visible_short_alias = 'd', action = clap::ArgAction::Count)]
47 pub verbose: u8,
48}
49
50impl GitMoverCli {
51 pub async fn main(self) -> Result<(), GitMoverError> {
55 let config = GitMoverConfig::try_new(self)?;
56 if config.cli_args.show_config_path {
57 println!("{}", config.config_path.display());
58 return Ok(());
59 }
60 main_sync(config).await
61 }
62}
63
64pub async fn git_mover_main() -> Result<(), GitMoverError> {
68 let git_mover_inst = GitMoverCli::parse();
69 git_mover_inst.main().await
70}