mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-29 04:21:06 -05:00
7d09c5a4bf
Signed-off-by: vsoch <vsoch@users.noreply.github.com> Co-authored-by: vsoch <vsoch@users.noreply.github.com>
59 lines
1.1 KiB
Bash
Executable file
59 lines
1.1 KiB
Bash
Executable file
#!/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
|