openstack-manuals/tools/glossary-sort.sh
Andreas Jaeger 14268ec43e glossary-sort: Handle numbers as well
We were only extracting letters, handle numbers as well.

Change-Id: Ic4dfeb21eb2fb7b57a6a7f47432f13dbff9317cd
2016-11-15 09:04:36 +01:00

25 lines
612 B
Bash
Executable File

#!/bin/bash -xe
# Check that doc/common/glossary entries are alphabetized and prints
# list of entries that should be sorted.
export TMPDIR=`/bin/mktemp -d`
trap "rm -rf $TMPDIR" EXIT
pushd $TMPDIR
GLOSSARY=$OLDPWD/doc/common/glossary.rst
grep '^ [a-zA-Z0-9]' $GLOSSARY > glossary_entries
LC_ALL=C sort --ignore-case glossary_entries -o glossary_entries.sorted
if ! diff glossary_entries glossary_entries.sorted > glossary_entries.diff; then
echo "The following entries should be alphabetized: "
cat glossary_entries.diff | grep -e '> '
exit 1
else
echo "Glossary alphabetized."
fi
popd