Skip to content

Commit 06124e8

Browse files
committed
Simplify updating readme methods
1 parent b632753 commit 06124e8

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

scripts/update_readme_methods.sh

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,10 @@ after=$(tail -n +$(
1111

1212
echo "${before}" > "README.md"
1313

14-
curl_max_line_number=$(grep --context="0" --line-number --max-count="1" '^}$' "src/Curl/Curl.php" | \
15-
perl -pe 's/^(\d+):.*/\1/')
1614
echo '```php' >> "README.md"
17-
head -n "${curl_max_line_number}" "src/Curl/Curl.php" | \
18-
egrep "^ .* function .*" | \
19-
egrep "^ public" | \
20-
sort | \
21-
perl -pe 's/^ public (.* )?function /Curl::/' \
22-
>> "README.md"
23-
egrep "^ .* function .*" "src/Curl/MultiCurl.php" | \
24-
egrep "^ public" | \
25-
sort | \
26-
perl -pe 's/^ public (.* )?function /MultiCurl::/' \
27-
>> "README.md"
15+
find "src/Curl" -type f -name "*Curl*" |
16+
sort |
17+
xargs -L 1 -I {} bash -c 'class_name="$(basename --suffix=".php" "{}")" && egrep "^ .* function .*" "{}" | egrep "^ public" | sort | perl -pe "s/^ public (.* )?function /${class_name}::/"' >> "README.md"
2818
echo '```' >> "README.md"
2919
echo >> "README.md"
3020

0 commit comments

Comments
 (0)