Skip to content

Commit c56c005

Browse files
authored
Add script to update README with output from help commands (#220)
This will update all the `picotool help ...` sections in the README with the current output * Add workflow to check help text is up-to-date * Add a check that all commands have help text in the readme
1 parent f010190 commit c56c005

File tree

5 files changed

+612
-60
lines changed

5 files changed

+612
-60
lines changed

.github/workflows/check_help_text.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Check Help Text
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
check-help-text:
9+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Install dependencies (Linux)
16+
if: runner.os == 'Linux'
17+
run: sudo apt install cmake ninja-build python3 build-essential libusb-1.0-0-dev
18+
19+
- name: Checkout Pico SDK
20+
uses: actions/checkout@v4
21+
with:
22+
repository: raspberrypi/pico-sdk
23+
ref: develop
24+
path: pico-sdk
25+
submodules: 'true'
26+
27+
- name: Build and Install
28+
run: |
29+
cmake -S . -B build -G "Ninja" -D PICO_SDK_PATH="${{ github.workspace }}/pico-sdk" -D GENERATE_FIXED_DOCS_WIDTH=1
30+
cmake --build build
31+
sudo cmake --install build
32+
33+
- name: Check if help text needs updating
34+
run: |
35+
# Create a copy of README.md
36+
cp README.md README.md.orig
37+
38+
# Run the script
39+
./gen_help_txt.sh
40+
41+
# Compare the files
42+
if ! cmp -s README.md README.md.orig; then
43+
echo "Error: Help text in README.md is out of date - update by running gen_help_txt.sh, or use the artifact from this workflow"
44+
exit 1
45+
fi
46+
47+
# Clean up
48+
rm README.md.orig
49+
50+
- name: Upload new README.md
51+
if: always()
52+
uses: actions/upload-artifact@v4
53+
with:
54+
name: README.md
55+
path: README.md

CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,10 @@ else()
288288
${LIBUSB_LIBRARIES})
289289
endif()
290290

291+
if (GENERATE_FIXED_DOCS_WIDTH)
292+
target_compile_definitions(picotool PRIVATE DOCS_WIDTH=140)
293+
endif()
294+
291295
# allow `make install`
292296
install(TARGETS picotool
293297
EXPORT picotool-targets

0 commit comments

Comments
 (0)