10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-09 07:33:53 +01:00
quantum_package/scripts/create_rst_templates.sh

51 lines
761 B
Bash
Raw Normal View History

2014-04-03 13:59:51 +02:00
#!/bin/bash
#
# Creates the rst files when creating a new module.
# Thu Apr 3 11:54:16 CEST 2014
MODULE=$(basename $PWD)
if [[ $MODULE == "src" ]]
then
echo "Error: This script should not be run in the src directory."
exit 1
fi
function asksure() {
echo -n $@ "(Y/N) "
2014-04-03 16:23:27 +02:00
answer=w
while [[ $answer != [YyNn] ]]
do
read answer
[[ $answer = [Yy] ]] && retval=0 || retval=1
2014-04-03 13:59:51 +02:00
done
return $retval
}
2014-04-03 16:23:27 +02:00
README="True"
2014-04-03 13:59:51 +02:00
if [[ -f README.rst ]]
then
2014-04-03 16:23:27 +02:00
asksure "Overwrite existing README.rst file?" || README="False"
2014-04-03 13:59:51 +02:00
fi
UNDERLINE="======="
declare -i i=0
while [[ i -lt ${#MODULE} ]]
do
UNDERLINE+="="
i+=1
done
2014-04-03 16:23:27 +02:00
if [[ ${README} == "True" ]]
then
cat << EOF > ./README.rst
2014-04-03 13:59:51 +02:00
$UNDERLINE
$MODULE Module
$UNDERLINE
EOF
2014-04-03 16:23:27 +02:00
fi
touch ./ASSUMPTIONS.rst
2014-04-03 13:59:51 +02:00