dkl apply-config --dry-run
This commit is contained in:
@@ -24,6 +24,9 @@ enum Command {
|
||||
/// path prefix (aka chroot)
|
||||
#[arg(short = 'P', long, default_value = "/")]
|
||||
prefix: String,
|
||||
/// don't really write files
|
||||
#[arg(long)]
|
||||
dry_run: bool,
|
||||
},
|
||||
Logger {
|
||||
/// Path where the logs are stored
|
||||
@@ -97,9 +100,10 @@ async fn main() -> Result<()> {
|
||||
config,
|
||||
filters,
|
||||
prefix,
|
||||
dry_run,
|
||||
} => {
|
||||
let filters = parse_globs(&filters)?;
|
||||
apply_config(&config, &filters, &prefix).await
|
||||
apply_config(&config, &filters, &prefix, dry_run).await
|
||||
}
|
||||
C::Logger {
|
||||
ref log_path,
|
||||
@@ -156,7 +160,12 @@ async fn main() -> Result<()> {
|
||||
}
|
||||
}
|
||||
|
||||
async fn apply_config(config_file: &str, filters: &[glob::Pattern], chroot: &str) -> Result<()> {
|
||||
async fn apply_config(
|
||||
config_file: &str,
|
||||
filters: &[glob::Pattern],
|
||||
chroot: &str,
|
||||
dry_run: bool,
|
||||
) -> Result<()> {
|
||||
let config = fs::read_to_string(config_file).await?;
|
||||
let config: dkl::Config = serde_yaml::from_str(&config)?;
|
||||
|
||||
@@ -168,7 +177,7 @@ async fn apply_config(config_file: &str, filters: &[glob::Pattern], chroot: &str
|
||||
.collect()
|
||||
};
|
||||
|
||||
dkl::apply::files(&files, chroot).await
|
||||
dkl::apply::files(&files, chroot, dry_run).await
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
|
||||
Reference in New Issue
Block a user