Skip to content

Commit

Permalink
ravedude: fix open_console serialization & tweak error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Creative0708 authored and Rahix committed Jun 8, 2024
1 parent 6d0f0e0 commit 0ee4493
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions ravedude/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ impl RavedudeConfig {
#[derive(serde::Serialize, serde::Deserialize, Debug, Default)]
#[serde(rename_all = "kebab-case")]
pub struct RavedudeGeneralConfig {
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub open_console: bool,
pub serial_baudrate: Option<NonZeroU32>,
pub port: Option<std::path::PathBuf>,
Expand Down
11 changes: 7 additions & 4 deletions ravedude/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,12 @@ fn ravedude() -> anyhow::Result<()> {
anyhow::bail!("can't pass board as command-line argument when Ravedude.toml is present; set `board = {:?}` under [general] in Ravedude.toml", board)
}
}
} else if args.board.is_some() {
} else if args.board.is_some() && !args.dump_config {
warning!(
"Passing the board as command-line argument is deprecated, use Ravedude.toml instead:\n\n# Ravedude.toml\n{}",
"Passing the board as command-line argument is deprecated, use Ravedude.toml instead:"
);
eprintln!(
"\n# Ravedude.toml\n{}",
toml::to_string(&config::RavedudeConfig::from_args(&args)?)?
);
}
Expand All @@ -144,15 +147,15 @@ fn ravedude() -> anyhow::Result<()> {
)?
};

ravedude_config.general_options.apply_overrides(&mut args)?;

if args.dump_config {
println!("{}", toml::to_string(&ravedude_config)?);
return Ok(());
}

avrdude::Avrdude::require_min_ver(MIN_VERSION_AVRDUDE)?;

ravedude_config.general_options.apply_overrides(&mut args)?;

let Some(mut board) = ravedude_config.board_config else {
anyhow::bail!("no named board given and no board options provided");
};
Expand Down

0 comments on commit 0ee4493

Please sign in to comment.