|
4 | 4 | update-readme: |
5 | 5 | cmds: |
6 | 6 | - | |
7 | | - help_output=$(gcode-thumbnail-tool) |
8 | | - extract_output=$(gcode-thumbnail-tool extract --help) |
9 | | - analyse_output=$(gcode-thumbnail-tool analyse --help) |
| 7 | + help_command="gcode-thumbnail-tool" |
| 8 | + help_output=$($help_command) |
10 | 9 |
|
11 | | - awk -i inplace -v text="$help_output" ' |
| 10 | + extract_command="gcode-thumbnail-tool extract --help" |
| 11 | + extract_output=$($extract_command) |
| 12 | +
|
| 13 | + analyse_command="gcode-thumbnail-tool analyse --help" |
| 14 | + analyse_output=$($analyse_command) |
| 15 | +
|
| 16 | + example_command="gcode-thumbnail-tool analyse tests/_files/prusa_2.9.3.gcode" |
| 17 | + example_output=$($example_command) |
| 18 | +
|
| 19 | + awk -i inplace -v command="$help_command" -v output="$help_output" ' |
12 | 20 | BEGIN{p=1} |
13 | 21 | $1=="<!--INSERT:help-->"{p=0;print;next} |
14 | | - $1=="<!--/INSERT:help-->"{print "```\n" text "\n```"; p=1} |
| 22 | + $1=="<!--/INSERT:help-->"{print "```\n$ " command "\n" output "\n```"; p=1} |
15 | 23 | p |
16 | 24 | ' README.md |
17 | | - awk -i inplace -v text="$extract_output" ' |
| 25 | + awk -i inplace -v command="$extract_command" -v output="$extract_output" ' |
18 | 26 | BEGIN{p=1} |
19 | 27 | $1=="<!--INSERT:extract-->"{p=0;print;next} |
20 | | - $1=="<!--/INSERT:extract-->"{print "```\n" text "\n```"; p=1} |
| 28 | + $1=="<!--/INSERT:extract-->"{print "```\n$ " command "\n" output "\n```"; p=1} |
21 | 29 | p |
22 | 30 | ' README.md |
23 | | - awk -i inplace -v text="$analyse_output" ' |
| 31 | + awk -i inplace -v command="$analyse_command" -v output="$analyse_output" ' |
24 | 32 | BEGIN{p=1} |
25 | 33 | $1=="<!--INSERT:analyse-->"{p=0;print;next} |
26 | | - $1=="<!--/INSERT:analyse-->"{print "```\n" text "\n```"; p=1} |
| 34 | + $1=="<!--/INSERT:analyse-->"{print "```\n$ " command "\n" output "\n```"; p=1} |
| 35 | + p |
| 36 | + ' README.md |
| 37 | +
|
| 38 | + awk -i inplace -v command="$example_command" -v output="$example_output" ' |
| 39 | + BEGIN{p=1} |
| 40 | + $1=="<!--INSERT:example-->"{p=0;print;next} |
| 41 | + $1=="<!--/INSERT:example-->"{print "```\n$ " command "\n" output "\n```"; p=1} |
27 | 42 | p |
28 | 43 | ' README.md |
0 commit comments