#![allow(clippy::unnecessary_wraps)]
use clap::{AppSettings, Parser};
#[cfg(target_arch = "s390x")]
use libcoreinst::s390x;
#[derive(Debug, Parser)]
#[clap(name = "rdcore", version)]
#[clap(global_setting(AppSettings::DeriveDisplayOrder))]
#[clap(args_conflicts_with_subcommands = true)]
#[clap(disable_help_subcommand = true)]
#[clap(help_expected = true)]
pub enum Cmd {
Rootmap(RootmapConfig),
BindBoot(BindBootConfig),
Kargs(KargsConfig),
StreamHash(StreamHashConfig),
VerifyUniqueFsLabel(VerifyUniqueFsLabelConfig),
#[cfg(target_arch = "s390x")]
Zipl(ZiplConfig),
}
#[derive(Debug, Parser)]
pub struct RootmapConfig {
#[clap(long, value_name = "DEVPATH", conflicts_with = "boot-mount")]
pub boot_device: Option<String>,
#[clap(long, value_name = "BOOT_MOUNT", conflicts_with = "boot-device")]
pub boot_mount: Option<String>,
#[clap(value_name = "ROOT_MOUNT")]
pub root_mount: String,
}
#[derive(Debug, Parser)]
pub struct BindBootConfig {
#[clap(value_name = "ROOT_MOUNT")]
pub root_mount: String,
#[clap(value_name = "BOOT_MOUNT")]
pub boot_mount: String,
}
#[derive(Debug, Parser)]
pub struct KargsConfig {
#[clap(long, value_name = "DEVPATH")]
#[clap(conflicts_with = "boot-mount", conflicts_with = "current")]
pub boot_device: Option<String>,
#[clap(long, value_name = "BOOT_MOUNT")]
#[clap(conflicts_with = "boot-device", conflicts_with = "current")]
pub boot_mount: Option<String>,
#[clap(long)]
#[clap(conflicts_with = "boot-device", conflicts_with = "boot-mount")]
pub current: bool,
#[clap(long, value_name = "OPTIONS", hide = true)]
pub override_options: Option<String>,
#[clap(long, value_name = "PATH")]
pub create_if_changed: Option<String>,
#[clap(long, value_name = "ARG")]
pub append: Vec<String>,
#[clap(long, value_name = "ARG")]
#[clap(alias = "should-exist")]
pub append_if_missing: Vec<String>,
#[clap(long, value_name = "ARG")]
#[clap(alias = "should-not-exist")]
pub delete: Vec<String>,
}
#[derive(Debug, Parser)]
pub struct StreamHashConfig {
#[clap(value_name = "hash-file")]
pub hash_file: String,
}
#[derive(Debug, Parser)]
pub struct VerifyUniqueFsLabelConfig {
#[clap(value_name = "LABEL")]
pub label: String,
#[clap(long)]
pub rereadpt: bool,
}
#[cfg(target_arch = "s390x")]
#[derive(Debug, Parser)]
pub struct ZiplConfig {
#[clap(long, value_name = "BOOT_MOUNT")]
pub boot_mount: String,
#[clap(arg_enum)]
#[clap(long, default_value = "auto")]
pub secex_mode: s390x::ZiplSecexMode,
#[clap(long, value_name = "HOSTKEY")]
pub hostkey: Option<String>,
#[clap(long, value_name = "KARG")]
#[clap(alias = "kargs")]
pub append_karg: Option<Vec<String>>,
#[clap(long, value_name = "FILE")]
pub append_file: Option<Vec<String>>,
}
#[cfg(test)]
mod test {
use super::*;
use clap::IntoApp;
#[test]
fn clap_app() {
Cmd::command().debug_assert()
}
}