-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcli.rs
44 lines (39 loc) · 1.15 KB
/
cli.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
use clap::{Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(bin_name = "cargo")]
pub(crate) enum Cli {
#[command(subcommand)]
Libcnb(LibcnbSubcommand),
}
#[derive(Subcommand)]
#[command(version, about, long_about = None)]
pub(crate) enum LibcnbSubcommand {
/// Packages a libcnb.rs Cargo project as a Cloud Native Buildpack
Package(PackageArgs),
}
#[derive(Parser)]
pub(crate) struct PackageArgs {
/// Disable cross-compile assistance
#[arg(long)]
pub(crate) no_cross_compile_assistance: bool,
/// Build in release mode, with optimizations
#[arg(long)]
pub(crate) release: bool,
/// Build for the target triple
#[arg(long, default_value = "x86_64-unknown-linux-musl")]
pub(crate) target: String,
/// Directory for packaged buildpacks, defaults to 'packaged' in Cargo workspace root
#[arg(long)]
pub(crate) package_dir: Option<PathBuf>,
}
#[cfg(test)]
mod tests {
use super::*;
use clap::CommandFactory;
#[test]
fn verify_command() {
// Trigger Clap's internal assertions that validate the command configuration.
Cli::command().debug_assert();
}
}