-
Notifications
You must be signed in to change notification settings - Fork 4
/
update_readme.sh
executable file
·91 lines (64 loc) · 2.09 KB
/
update_readme.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env bash
## Helper script to run cargo show and update the README.md
# run from project root
# "cargo run show" for development or "cargo show" for a published version
CARGO_CMD="cargo run show"
cargo uninstall cargo-show || true
cargo install cargo-show &> ./cargo-show-install.log
cat > README.md <<EOF
## cargo-show
[![crates.io version](https://img.shields.io/crates/v/cargo-show.svg)](https://crates.io/crates/cargo-show)
[![Build status](https://github.com/g-k/cargo-show/actions/workflows/build.yml/badge.svg)](https://github.com/g-k/cargo-show/actions/workflows/build.yml)
Prints package metadata like pip show, apt-cache show, npm view, gem query, etc.
To install:
\`\`\`sh
\$ cargo install cargo-show
$(head -n5 ./cargo-show-install.log)
...
$(tail -n5 ./cargo-show-install.log)
\$
\`\`\`
Usage:
\`\`\`sh
\$ cargo show --help
$($CARGO_CMD --help)
\`\`\`
To print package metadata:
\`\`\`sh
\$ cargo show nonexistent-package servo
$($CARGO_CMD nonexistent-package servo 2>&1)
\`\`\`
To print JSON:
\`\`\`json
\$ cargo show --json serde | cut -b '1-120'
$($CARGO_CMD --json serde | cut -b '1-120')
\`\`\`
To print package metadata and direct dependencies (alternatively use \`-L\`):
\`\`\`sh
\$ cargo show --dependencies time
$($CARGO_CMD --dependencies time 2>&1)
\`\`\`
To print package metadata and direct dependencies as JSON:
\`\`\`sh
\$ cargo show --dependencies --json time | python -m json.tool | head -n25
$($CARGO_CMD --dependencies --json time | python -m json.tool | head -n25)
\`\`\`
To rename the command if you're used to other package managers:
\`\`\`sh
\$ cd /usr/local/bin/ # or someplace in path
\$ ln \$(which cargo-show) cargo-flizblorp # needs to be a hardlink
\$ cargo --list | grep fliz
flizblorp
\`\`\`
### Maintainers
* [@g-k](https://github.com/g-k)
* [@pravic](https://github.com/pravic)
### Contributors
* [@g-k](https://github.com/g-k)
* [@leoschwarz](https://github.com/leoschwarz)
* [@pravic](https://github.com/pravic)
EOF
rm ./cargo-show-install.log
## if the readme changed cargo-show is broken or metadata from the
## example crates changed
git diff