use clap::{Args, Subcommand};
use super::ImportLocalArgs;
#[derive(Args, Clone, Debug)]
#[command(verbatim_doc_comment)]
#[command(about = "Bring an existing Git repository into Heddle.")]
#[command(long_about = "Bring an existing Git repository into Heddle.")]
#[command(after_help = "\
Choose a source:
local Import a Git checkout on this computer.
url Have the server import a public HTTPS Git URL.
Already checked out the repository?
heddle import local .
heddle push <destination>
Want the server to fetch it, without a local checkout?
heddle import url https://github.com/acme/widget.git --to <handle>/widget
Use \"heddle init\" to start a repository or keep working in Git mode.
Use \"heddle clone\" to download an existing hosted Heddle repository.
")]
pub struct ImportArgs {
#[command(subcommand)]
pub command: ImportCommands,
}
#[derive(Subcommand, Clone, Debug)]
pub enum ImportCommands {
Local(ImportLocalArgs),
#[cfg(feature = "client")]
Url(ImportUrlArgs),
#[cfg(feature = "client")]
Status(ImportOperationArgs),
#[cfg(feature = "client")]
Retry(ImportOperationArgs),
}
#[cfg(feature = "client")]
#[derive(Args, Clone, Debug)]
pub struct ImportUrlArgs {
#[arg(value_name = "URL")]
pub url: String,
#[arg(long, value_name = "SPOOL|URL")]
pub to: String,
#[arg(long, value_name = "HOST")]
pub server: Option<String>,
}
#[cfg(feature = "client")]
#[derive(Args, Clone, Debug)]
pub struct ImportOperationArgs {
#[arg(value_name = "OPERATION")]
pub operation: String,
#[arg(long, value_name = "SPOOL|URL")]
pub to: String,
#[arg(long, value_name = "HOST")]
pub server: Option<String>,
}