heddle_cli_args/cli/cli_args/
commands_import.rs1use clap::{Args, Subcommand};
5
6use super::ImportLocalArgs;
7
8#[derive(Args, Clone, Debug)]
9#[command(verbatim_doc_comment)]
10#[command(about = "Bring an existing Git repository into Heddle.")]
11#[command(long_about = "Bring an existing Git repository into Heddle.")]
12#[command(after_help = "\
13Choose a source:
14 local Import a Git checkout on this computer.
15 url Have the server import a public HTTPS Git URL.
16
17Already checked out the repository?
18 heddle import local .
19 heddle push <destination>
20
21Want the server to fetch it, without a local checkout?
22 heddle import url https://github.com/acme/widget.git --to <handle>/widget
23
24Manage a hosted import:
25 heddle import status <operation> --to <handle>/widget
26 heddle import cancel <operation> --to <handle>/widget
27
28Use \"heddle init\" to start a repository or keep working in Git mode.
29Use \"heddle clone\" to download an existing hosted Heddle repository.
30")]
31pub struct ImportArgs {
32 #[command(subcommand)]
33 pub command: ImportCommands,
34}
35
36#[derive(Subcommand, Clone, Debug)]
37pub enum ImportCommands {
38 Local(ImportLocalArgs),
40
41 #[cfg(feature = "client")]
43 Url(ImportUrlArgs),
44
45 #[cfg(feature = "client")]
50 Status(ImportOperationArgs),
51
52 #[cfg(feature = "client")]
54 Retry(ImportOperationArgs),
55
56 #[cfg(feature = "client")]
66 #[command(after_help = "Exit codes:
67 0 Cancellation requested or operation already terminal.
68 64 Invalid arguments.
69 74 IO failure.
70 75 Transient failure; safe to retry.
71 76 Server refused cancellation or rejected the request.
72 77 Caller is not authorized.
73 78 Missing configuration or operation (including another account's operation).")]
74 Cancel(ImportOperationArgs),
75}
76
77#[cfg(feature = "client")]
78#[derive(Args, Clone, Debug)]
79pub struct ImportUrlArgs {
80 #[arg(value_name = "URL")]
82 pub url: String,
83
84 #[arg(long, value_name = "SPOOL|URL")]
86 pub to: String,
87
88 #[arg(long, value_name = "HOST")]
90 pub server: Option<String>,
91}
92
93#[cfg(feature = "client")]
94#[derive(Args, Clone, Debug)]
95pub struct ImportOperationArgs {
96 #[arg(value_name = "OPERATION")]
98 pub operation: String,
99
100 #[arg(long, value_name = "SPOOL|URL")]
102 pub to: String,
103
104 #[arg(long, value_name = "HOST")]
106 pub server: Option<String>,
107}