rust-installer: drop clap v3, migrate to v4

This commit is contained in:
klensy 2023-06-21 12:32:34 +03:00
parent b9d608c979
commit e1c3313d38
7 changed files with 46 additions and 121 deletions

View file

@ -20,4 +20,4 @@ num_cpus = "1"
[dependencies.clap]
features = ["derive"]
version = "3.1"
version = "4.2"

View file

@ -13,47 +13,47 @@ actor! {
#[derive(Debug)]
pub struct Combiner {
/// The name of the product, for display.
#[clap(value_name = "NAME")]
#[arg(value_name = "NAME")]
product_name: String = "Product",
/// The name of the package tarball.
#[clap(value_name = "NAME")]
#[arg(value_name = "NAME")]
package_name: String = "package",
/// The directory under lib/ where the manifest lives.
#[clap(value_name = "DIR")]
#[arg(value_name = "DIR")]
rel_manifest_dir: String = "packagelib",
/// The string to print after successful installation.
#[clap(value_name = "MESSAGE")]
#[arg(value_name = "MESSAGE")]
success_message: String = "Installed.",
/// Places to look for legacy manifests to uninstall.
#[clap(value_name = "DIRS")]
#[arg(value_name = "DIRS")]
legacy_manifest_dirs: String = "",
/// Installers to combine.
#[clap(value_name = "FILE,FILE")]
#[arg(value_name = "FILE,FILE")]
input_tarballs: String = "",
/// Directory containing files that should not be installed.
#[clap(value_name = "DIR")]
#[arg(value_name = "DIR")]
non_installed_overlay: String = "",
/// The directory to do temporary work.
#[clap(value_name = "DIR")]
#[arg(value_name = "DIR")]
work_dir: String = "./workdir",
/// The location to put the final image and tarball.
#[clap(value_name = "DIR")]
#[arg(value_name = "DIR")]
output_dir: String = "./dist",
/// The profile used to compress the tarball.
#[clap(value_name = "FORMAT", default_value_t)]
#[arg(value_name = "FORMAT", default_value_t)]
compression_profile: CompressionProfile,
/// The formats used to compress the tarball
#[clap(value_name = "FORMAT", default_value_t)]
#[arg(value_name = "FORMAT", default_value_t)]
compression_formats: CompressionFormats,
}
}

View file

@ -11,55 +11,55 @@ actor! {
#[derive(Debug)]
pub struct Generator {
/// The name of the product, for display
#[clap(value_name = "NAME")]
#[arg(value_name = "NAME")]
product_name: String = "Product",
/// The name of the component, distinct from other installed components
#[clap(value_name = "NAME")]
#[arg(value_name = "NAME")]
component_name: String = "component",
/// The name of the package, tarball
#[clap(value_name = "NAME")]
#[arg(value_name = "NAME")]
package_name: String = "package",
/// The directory under lib/ where the manifest lives
#[clap(value_name = "DIR")]
#[arg(value_name = "DIR")]
rel_manifest_dir: String = "packagelib",
/// The string to print after successful installation
#[clap(value_name = "MESSAGE")]
#[arg(value_name = "MESSAGE")]
success_message: String = "Installed.",
/// Places to look for legacy manifests to uninstall
#[clap(value_name = "DIRS")]
#[arg(value_name = "DIRS")]
legacy_manifest_dirs: String = "",
/// Directory containing files that should not be installed
#[clap(value_name = "DIR")]
#[arg(value_name = "DIR")]
non_installed_overlay: String = "",
/// Path prefixes of directories that should be installed/uninstalled in bulk
#[clap(value_name = "DIRS")]
#[arg(value_name = "DIRS")]
bulk_dirs: String = "",
/// The directory containing the installation medium
#[clap(value_name = "DIR")]
#[arg(value_name = "DIR")]
image_dir: String = "./install_image",
/// The directory to do temporary work
#[clap(value_name = "DIR")]
#[arg(value_name = "DIR")]
work_dir: String = "./workdir",
/// The location to put the final image and tarball
#[clap(value_name = "DIR")]
#[arg(value_name = "DIR")]
output_dir: String = "./dist",
/// The profile used to compress the tarball.
#[clap(value_name = "FORMAT", default_value_t)]
#[arg(value_name = "FORMAT", default_value_t)]
compression_profile: CompressionProfile,
/// The formats used to compress the tarball
#[clap(value_name = "FORMAT", default_value_t)]
#[arg(value_name = "FORMAT", default_value_t)]
compression_formats: CompressionFormats,
}
}

View file

@ -8,23 +8,23 @@ actor! {
#[derive(Debug)]
pub struct Scripter {
/// The name of the product, for display
#[clap(value_name = "NAME")]
#[arg(value_name = "NAME")]
product_name: String = "Product",
/// The directory under lib/ where the manifest lives
#[clap(value_name = "DIR")]
#[arg(value_name = "DIR")]
rel_manifest_dir: String = "manifestlib",
/// The string to print after successful installation
#[clap(value_name = "MESSAGE")]
#[arg(value_name = "MESSAGE")]
success_message: String = "Installed.",
/// Places to look for legacy manifests to uninstall
#[clap(value_name = "DIRS")]
#[arg(value_name = "DIRS")]
legacy_manifest_dirs: String = "",
/// The name of the output script
#[clap(value_name = "FILE")]
#[arg(value_name = "FILE")]
output_script: String = "install.sh",
}
}

View file

@ -14,23 +14,23 @@ actor! {
#[derive(Debug)]
pub struct Tarballer {
/// The input folder to be compressed.
#[clap(value_name = "NAME")]
#[arg(value_name = "NAME")]
input: String = "package",
/// The prefix of the tarballs.
#[clap(value_name = "PATH")]
#[arg(value_name = "PATH")]
output: String = "./dist",
/// The folder in which the input is to be found.
#[clap(value_name = "DIR")]
#[arg(value_name = "DIR")]
work_dir: String = "./workdir",
/// The profile used to compress the tarball.
#[clap(value_name = "FORMAT", default_value_t)]
#[arg(value_name = "FORMAT", default_value_t)]
compression_profile: CompressionProfile,
/// The formats used to compress the tarball.
#[clap(value_name = "FORMAT", default_value_t)]
#[arg(value_name = "FORMAT", default_value_t)]
compression_formats: CompressionFormats,
}
}

View file

@ -135,7 +135,7 @@ macro_rules! actor {
$( #[ $attr ] )+
#[derive(clap::Args)]
pub struct $name {
$( $( #[ $field_attr ] )+ #[clap(long, $(default_value = $default)*)] $field : $type, )*
$( $( #[ $field_attr ] )+ #[arg(long, $(default_value = $default)*)] $field : $type, )*
}
impl Default for $name {