1 Star 17 Fork 3

Lee Lup Yuen 李立源 / stm32-blue-pill-rust

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
gen-examples.sh 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
Lee Lup Yuen 李立源 提交于 2018-07-06 09:13 . Added source files
# Converts the examples in the `examples` directory into documentation in the
# `examples` module (`src/examples/*.rs`)
set -ex
main() {
local examples=(
minimal
hello
itm
panic
crash
exception
allocator
device
)
rm -rf src/examples
mkdir src/examples
cat >src/examples/mod.rs <<'EOF'
//! Examples sorted in increasing degree of complexity
// Auto-generated. Do not modify.
EOF
local i=0 out=
for ex in ${examples[@]}; do
name=_${i}_${ex//-/_}
out=src/examples/${name}.rs
echo "pub mod $name;" >> src/examples/mod.rs
grep '//!' examples/$ex.rs > $out
echo '//!' >> $out
echo '//! ```' >> $out
grep -v '//!' examples/$ex.rs | (
IFS=''
while read line; do
echo "//! $line" >> $out;
done
)
echo '//! ```' >> $out
echo '// Auto-generated. Do not modify.' >> $out
chmod -x $out
i=$(( i + 1 ))
done
chmod -x src/examples/mod.rs
}
main
Rust
1
https://gitee.com/lupyuen/stm32-blue-pill-rust.git
git@gitee.com:lupyuen/stm32-blue-pill-rust.git
lupyuen
stm32-blue-pill-rust
stm32-blue-pill-rust
master

搜索帮助