-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path_makescriptlist
More file actions
executable file
·35 lines (24 loc) · 1.09 KB
/
_makescriptlist
File metadata and controls
executable file
·35 lines (24 loc) · 1.09 KB
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
#!/usr/bin/env bash
$(dirname "$(realpath "$0")")/../bin/_makeusagetxt
cd $(dirname "$(realpath "$0")")
tmp_result=$(mktemp)
tmp_script=$(mktemp)
trap "rm $tmp_result; rm $tmp_script;" EXIT
echo "<!-- Start scriptlist -->" > $tmp_script
echo >> $tmp_script
# for each executable file in ../bin/ that is not named _* call it with --help and write the outpit into tmp_dir/$(basename $file)
for file in $(find $(dirname "$(realpath "$0")")/../bin/ -maxdepth 1 -type f -perm -u=x ! -name "_*" | sort); do
base=$(basename $file)
echo
echo "Processing $base"
$file -h > _scriptusages/usage.$base.txt
aigenpipeline -p scriptdescr.prompt _scriptusages/usage.$base.txt -upd -o _scriptdescriptions/description.$base.txt
echo " - [$base](bin/$base)" $(tail -n +3 _scriptdescriptions/description.$base.txt) >> $tmp_script
done
echo >> $tmp_script
echo "<!-- End scriptlist -->" >> $tmp_script
sed -e '/Start scriptlist/,/End scriptlist/!b' -e "/End scriptlist/r $tmp_script" -e 'd' ../README.md > $tmp_result
sleep 3
cat $tmp_result > ../README.md
echo
echo "The README.md was updated with the script list."