Skip to main content

cargo_shipit/
cli.rs

1pub use clap::Parser;
2
3#[derive(Parser, Debug)]
4#[command(author, version, about = "Cargo subcommand for building and deploying Rust binaries to Linux targets via SSH. Ship it!", long_about = None)]
5pub struct CliArgs {
6    #[arg(
7        short,
8        long,
9        help = "The path to the configuration file",
10        default_value = "shipit.json"
11    )]
12    pub config: String,
13    #[arg(
14        short = 'b',
15        long,
16        help = "The binary files to upload to the Linux target (auto-detected from Cargo.toml if not specified)"
17    )]
18    pub binaries: Vec<String>,
19    #[arg(short = 'd', long, help = "Enable debug mode", default_value = "false")]
20    pub debug: bool,
21    #[arg(
22        short = 'r',
23        long,
24        help = "The remote directory path on the Linux target"
25    )]
26    pub remote_folder: Option<String>,
27    #[arg(short = 'H', long, help = "Hostname or IP address of the Linux target")]
28    pub host: Option<String>,
29    #[arg(short = 'U', long, help = "SSH username for the Linux target")]
30    pub username: Option<String>,
31    #[arg(short = 'P', long, help = "SSH password for the Linux target")]
32    pub password: Option<String>,
33    #[arg(
34        short = 'k',
35        long,
36        help = "Path to SSH private key file for authentication"
37    )]
38    pub key: Option<String>,
39    #[arg(
40        short = 'p',
41        long,
42        default_value = "22",
43        help = "SSH port of the Linux target"
44    )]
45    pub port: Option<u16>,
46    #[arg(
47        short = 't',
48        long,
49        help = "Rust target triple for cross-compilation (e.g., 'armv7-unknown-linux-gnueabihf', 'aarch64-unknown-linux-gnu')"
50    )]
51    pub target: Option<String>,
52    #[arg(short = 'T', long, help = "Local cargo target directory path")]
53    pub target_folder: Option<String>,
54
55    #[arg(
56        short,
57        long,
58        help = "Initialize a new configuration file at the specified path"
59    )]
60    pub init: Option<String>,
61
62    #[arg(
63        short = 'B',
64        long,
65        default_value = "false",
66        help = "Build the project before uploading"
67    )]
68    pub build: bool,
69
70    #[arg(
71        long,
72        help = "Build profile to use (debug, release, or custom profile name)",
73        default_value = "release"
74    )]
75    pub profile: String,
76}