]> git.proxmox.com Git - rustc.git/blob - vendor/chrono/ci/fix-readme.sh
New upstream version 1.45.0+dfsg1
[rustc.git] / vendor / chrono / ci / fix-readme.sh
1 #!/bin/bash
2
3 VERSION="$( cargo read-manifest | python -c 'import json, sys; print(json.load(sys.stdin)["version"])')"
4 LIB="$1"
5
6 # Make the Chrono in the header a link to the docs
7 awk '/^\/\/! # Chrono: / { print "[Chrono][docsrs]:", substr($0, index($0, $4))}' "$LIB"
8 awk '/^\/\/! # Chrono: / { print "[Chrono][docsrs]:", substr($0, index($0, $4))}' "$LIB" | sed 's/./=/g'
9 # Add all the badges
10 echo '
11 [![Chrono on Travis CI][travis-image]][travis]
12 [![Chrono on Appveyor][appveyor-image]][appveyor]
13 [![Chrono on crates.io][cratesio-image]][cratesio]
14 [![Chrono on docs.rs][docsrs-image]][docsrs]
15 [![Join the chat at https://gitter.im/chrono-rs/chrono][gitter-image]][gitter]
16
17 [travis-image]: https://travis-ci.org/chronotope/chrono.svg?branch=master
18 [travis]: https://travis-ci.org/chronotope/chrono
19 [appveyor-image]: https://ci.appveyor.com/api/projects/status/2ia91ofww4w31m2w/branch/master?svg=true
20 [appveyor]: https://ci.appveyor.com/project/chronotope/chrono
21 [cratesio-image]: https://img.shields.io/crates/v/chrono.svg
22 [cratesio]: https://crates.io/crates/chrono
23 [docsrs-image]: https://docs.rs/chrono/badge.svg
24 [docsrs]: https://docs.rs/chrono
25 [gitter-image]: https://badges.gitter.im/chrono-rs/chrono.svg
26 [gitter]: https://gitter.im/chrono-rs/chrono'
27
28 # print the section between the header and the usage
29 awk '/^\/\/! # Chrono:/,/^\/\/! ## /' "$LIB" | cut -b 5- | grep -v '^#' | \
30 sed 's/](\.\//](https:\/\/docs.rs\/chrono\/'$VERSION'\/chrono\//g'
31 echo
32 # Replace relative doc links with links to this exact version of docs on
33 # docs.rs
34 awk '/^\/\/! ## /,!/^\/\/!/' "$LIB" | cut -b 5- | grep -v '^# ' | \
35 sed 's/](\.\//](https:\/\/docs.rs\/chrono\/'$VERSION'\/chrono\//g' \