Rename some things

This commit is contained in:
datdenkikniet 2023-04-15 20:57:27 +02:00
parent 6517a4bec2
commit 859cd418f0
3 changed files with 8 additions and 8 deletions

View file

@ -304,24 +304,24 @@ pub enum Commands {
/// Check one or more usage examples.
///
/// Usage examples are located in ./examples
UsageExamplesCheck(UsageExamples),
UsageExampleCheck(UsageExamplesOpt),
/// Build one or more usage examples.
///
/// Usage examples are located in ./examples
#[clap(alias = "./examples")]
UsageExampleBuild(UsageExamples),
UsageExampleBuild(UsageExamplesOpt),
}
#[derive(Args, Clone, Debug)]
pub struct UsageExamples {
pub struct UsageExamplesOpt {
/// The usage examples to build. All usage examples are selected if this argument is not provided.
///
/// Example: `rp2040_local_i2c_init,stm32f3_blinky`.
examples: Option<String>,
}
impl UsageExamples {
impl UsageExamplesOpt {
pub fn examples(&self) -> anyhow::Result<Vec<String>> {
let usage_examples: Vec<_> = std::fs::read_dir("./examples")?
.filter_map(Result::ok)

View file

@ -831,16 +831,16 @@ pub fn handle_results(globals: &Globals, results: Vec<FinalRunResult>) -> Result
};
if globals.verbose > 0 {
info!("✅ Success:{path} {cmd}\n {}", cmd.as_cmd_string());
info!("✅ Success: {cmd}{path}\n {}", cmd.as_cmd_string());
} else {
info!("✅ Success:{path} {cmd}");
info!("✅ Success:{cmd}{path}");
}
});
errors.clone().for_each(|(cmd, _, _)| {
if let Some(dir) = cmd.chdir() {
let path = dir.as_os_str().to_str().unwrap_or("Not displayable");
error!("❌ Failed: (in {path}) {cmd}\n {}", cmd.as_cmd_string());
error!("❌ Failed: {cmd} (in {path}) \n {}", cmd.as_cmd_string());
} else {
error!("❌ Failed: {cmd}\n {}", cmd.as_cmd_string());
}

View file

@ -288,7 +288,7 @@ fn main() -> anyhow::Result<()> {
info!("Running mdbook");
cargo_book(globals, &args.arguments)
}
Commands::UsageExamplesCheck(examples) => {
Commands::UsageExampleCheck(examples) => {
info!("Checking usage examples");
cargo_usage_example(globals, BuildOrCheck::Check, examples.examples()?)
}