operations-guide/tools/glossary-sort.sh
Sean McGinnis c68bdb82bf Restore operations-guide content
This restores the content of the repo to include all changes that
were done while the content was moved to the openstack-manuals
repo. There were also some updates and fixes to get the content
to build and pass jobs with the current doc job definitions.

Change-Id: Ic05b44a210a93667490096cffc8f2e45575ffb34
2018-06-28 10:52:46 -05:00

26 lines
736 B
Bash
Executable File

#!/bin/bash -xe
# Check that doc/common/glossary entries are alphabetized and prints
# list of entries that should be sorted.
# Cross-platform (Mac and Linux) commands to make a temporary working directory
thetmpdir=`mktemp -d 2>/dev/null || mktemp -d -t 'thetmpdir'`
trap "rm -rf $thetmpdir" EXIT
pushd $thetmpdir
GLOSSARY=$OLDPWD/doc/source/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