Debian Codegraph @

third_party/rust/zerocopy/generate-readme.sh

raw
1 #!/bin/bash
2 #
3 # Copyright 2022 The Fuchsia Authors
4 #
5 # Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
6 # <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
7 # license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
8 # This file may not be copied, modified, or distributed except according to
9 # those terms.
10
11 set -eo pipefail
12
13 COPYRIGHT_HEADER=$(mktemp)
14 BODY=$(mktemp)
15 DISCLAIMER_FOOTER=$(mktemp)
16
17 cat > $COPYRIGHT_HEADER <<'EOF'
18 <!-- Copyright 2022 The Fuchsia Authors
19
20 Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
21 <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT
22 license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option.
23 This file may not be copied, modified, or distributed except according to
24 those terms.
25
26 WARNING: DO NOT EDIT THIS FILE. It is generated automatically. Edits should be
27 made in the doc comment on `src/lib.rs` or in `generate-readme.sh`.
28 -->
29
30 EOF
31
32 # This uses the `cargo readme` tool, which you can install via `cargo install
33 # cargo-readme --version 3.2.0`.
34 #
35 # The `sed` command is used to strip code links like:
36 #
37 # /// Here is a link to [`Vec`].
38 #
39 # These links don't work in a Markdown file, and so we remove the `[` and `]`
40 # characters to convert them to non-link code snippets.
41 cargo readme --no-license | sed 's/\[\(`[^`]*`\)]/\1/g' > $BODY
42
43 cat > $DISCLAIMER_FOOTER <<'EOF'
44
45 ## Disclaimer
46
47 Disclaimer: Zerocopy is not an officially supported Google product.
48 EOF
49
50 cat $COPYRIGHT_HEADER $BODY $DISCLAIMER_FOOTER