mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-22 00:51:11 -05:00
60 lines
1.1 KiB
Bash
60 lines
1.1 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
set -e
|
||
|
|
||
|
printf "Found files in workspace:\n"
|
||
|
ls
|
||
|
|
||
|
printf "\nLooking for typos installed...\n"
|
||
|
which typos
|
||
|
|
||
|
COMMAND="typos"
|
||
|
|
||
|
# Show the _typos.toml file
|
||
|
if [ -f "_typos.toml" ]; then
|
||
|
echo "_typos.toml:"
|
||
|
cat _typos.toml
|
||
|
echo
|
||
|
fi
|
||
|
|
||
|
# Ignore implicit configuration files
|
||
|
if [ "${INPUT_ISOLATED}" == "true" ]; then
|
||
|
COMMAND="${COMMAND} --isolated"
|
||
|
fi
|
||
|
|
||
|
|
||
|
# Use a custom configuration file
|
||
|
if [ ! -z "${INPUT_CONFIG}" ]; then
|
||
|
|
||
|
# It must exist
|
||
|
if [ ! -f "${INPUT_CONFIG}" ]; then
|
||
|
printf "${INPUT_CONFIG} does not exist.\n"
|
||
|
exit 1;
|
||
|
else
|
||
|
# Show the custom config to the user
|
||
|
printf "Custom config:\n"
|
||
|
cat "${INPUT_CONFIG}"
|
||
|
echo
|
||
|
fi
|
||
|
COMMAND="${COMMAND} --config ${INPUT_CONFIG}"
|
||
|
fi
|
||
|
|
||
|
# Files are technically optional
|
||
|
if [ ! -z "${INPUT_FILES}" ]; then
|
||
|
COMMAND="${COMMAND} ${INPUT_FILES}"
|
||
|
fi
|
||
|
|
||
|
echo "Command: "
|
||
|
echo "${COMMAND}"
|
||
|
echo
|
||
|
|
||
|
${COMMAND}
|
||
|
retval=$?
|
||
|
|
||
|
if [[ "${retval}" -eq 0 ]]; then
|
||
|
printf "No spelling mistakes found! 🎉️\n"
|
||
|
else
|
||
|
printf "Spelling mistakes found! 😱️\n"
|
||
|
exit $retval;
|
||
|
fi
|