From d6497f2c35ee3536d98b418139df59bd47deb3c6 Mon Sep 17 00:00:00 2001 From: messense Date: Sat, 25 Feb 2023 09:48:29 +0800 Subject: [PATCH] Record `generate-ci` command arguments in generate configuration --- src/ci.rs | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/src/ci.rs b/src/ci.rs index d4ec73066..2896a7b55 100644 --- a/src/ci.rs +++ b/src/ci.rs @@ -149,8 +149,23 @@ impl GenerateCI { | BridgeModel::Cffi | BridgeModel::UniFfi ); + let gen_cmd = std::env::args() + .enumerate() + .map(|(i, arg)| { + if i == 0 { + env!("CARGO_PKG_NAME").to_string() + } else { + arg + } + }) + .collect::>() + .join(" "); let mut conf = format!( - "# Generated by maturin v{version} + "# This file is autogenerated by maturin v{version} +# To update, run +# +# {gen_cmd} +# on: push: branches: @@ -429,7 +444,7 @@ mod tests { .generate_github("example", &BridgeModel::Bindings("pyo3".to_string(), 7)) .unwrap() .lines() - .skip(1) + .skip(5) .collect::>() .join("\n"); let expected = indoc! {r#" @@ -533,7 +548,7 @@ mod tests { .generate_github("example", &BridgeModel::BindingsAbi3(3, 7)) .unwrap() .lines() - .skip(1) + .skip(5) .collect::>() .join("\n"); let expected = indoc! {r#" @@ -642,7 +657,7 @@ mod tests { .generate_github("example", &BridgeModel::Bindings("pyo3".to_string(), 7)) .unwrap() .lines() - .skip(1) + .skip(5) .collect::>() .join("\n"); let expected = indoc! {r#" @@ -785,7 +800,7 @@ mod tests { .generate_github("example", &BridgeModel::Bin(None)) .unwrap() .lines() - .skip(1) + .skip(5) .collect::>() .join("\n"); let expected = indoc! {r#"