Skip to content

Commit 160d00f

Browse files
committed
Add a little more automation for the release
Add an awk script for automatically updating the help text in README.md
1 parent ff1f66c commit 160d00f

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

doc/release-checklist.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ necessary changes for the upcoming release.
55

66
## Version bump
77

8+
This section can be done by running `scripts/version-bump.sh` with the new version
9+
as an argument.
10+
811
- [ ] Create a new branch for the required changes for this release.
912
- [ ] Update version in `Cargo.toml`. Run `cargo build` to update `Cargo.lock`.
1013
Make sure to `git add` the `Cargo.lock` changes as well.
@@ -21,7 +24,7 @@ necessary changes for the upcoming release.
2124
new version).
2225
- [ ] Review `-h`, `--help`, and the `man` page.
2326
- [ ] Run `fd -h` and copy the output to the *"Command-line options"* section in
24-
the README
27+
the README. This can be done by running `gawk -i inplace -f scripts/update-help.awk README.md`.
2528
- [ ] Push all changes and wait for CI to succeed (before continuing with the
2629
next section).
2730
- [ ] Optional: manually test the new features and command-line options described

scripts/update-help.awk

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/gawk -f
2+
3+
BEGIN {
4+
inSection = 0
5+
inBlock = 0
6+
}
7+
8+
9+
/Command-line options/ { inSection=1 }
10+
11+
inSection && /^```/ {
12+
inBlock=1
13+
inSection=0
14+
# print the starting fence then move to next line
15+
print
16+
next
17+
}
18+
19+
inBlock && /^```/ {
20+
cmd="cargo run --release --quiet -- -h"
21+
# Output the results of fd -h
22+
u=0
23+
while (cmd | getline line) {
24+
# Skip everything before the usage line
25+
if (line ~ /^Usage/) {
26+
u=1;
27+
}
28+
if (u) {
29+
print line
30+
}
31+
}
32+
status = close(cmd)
33+
if (status) {
34+
print "failed to generate help output" > "/dev/stderr"
35+
exit 1
36+
}
37+
inBlock = 0
38+
}
39+
40+
!inBlock
41+

0 commit comments

Comments
 (0)