mirror of
https://github.com/dylanaraps/pure-sh-bible
synced 2024-05-05 23:23:14 +02:00
docs: update
This commit is contained in:
parent
4fe65f31d1
commit
9d54e96011
9
.github/workflows/main.yml
vendored
Normal file
9
.github/workflows/main.yml
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
name: Shellcheck
|
||||
on: [push]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Run shellcheck.
|
||||
run: ./test.sh
|
24
test.sh
Executable file
24
test.sh
Executable file
|
@ -0,0 +1,24 @@
|
|||
#!/bin/sh
|
||||
# shellcheck source=/dev/null
|
||||
#
|
||||
# Tests for the Pure sh Bible.
|
||||
|
||||
main() {
|
||||
trap 'rm -f readme_code test_file' EXIT INT
|
||||
|
||||
# Extract code blocks from the README.
|
||||
while read -r line; do
|
||||
[ "$code" ] && [ "$line" != \`\`\` ] &&
|
||||
printf '%s\n' "$line"
|
||||
|
||||
case $line in
|
||||
\`\`\`sh) code=1 ;;
|
||||
\`\`\`) code=
|
||||
esac
|
||||
done < README.md > readme_code
|
||||
|
||||
# Run shellcheck and source the code.
|
||||
shellcheck -s sh readme_code test.sh || exit 1
|
||||
}
|
||||
|
||||
main "$@"
|
Loading…
Reference in a new issue