1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2024-12-31 21:22:38 +02:00

Style and possible syntax issue fixes (linting via ShellCheck)

This commit is contained in:
Ryan L McIntyre 2016-10-29 11:09:21 -04:00
parent bb5c998e15
commit cc51226f4c

View File

@ -6,62 +6,45 @@
infofilename="font-info.md"
cd unpatched-sample-fonts/
cd unpatched-sample-fonts/ || exit
#find ./DejaVuSansMono -type d | # uncomment to test 1 font
find -type d | # uncomment to do ALL fonts
while read filename
find . -type d | # uncomment to do ALL fonts
while read -r filename
do
#echo "filename $filename"
dirname=`dirname $filename`
basename=`basename $filename`
echo "dirname $dirname"
echo "basename $basename"
dirname=$(dirname "$filename")
searchdir=$filename
# limit looking for the readme files in the parent dir not the child dirs:
if [[ $dirname != "." ]];
then
echo "look up a lvl"
searchdir=$dirname
fi
RST=( $(find $searchdir -type f -iname 'readme.rst' -exec basename {} \;) )
TXT=( $(find $searchdir -type f -iname 'readme.txt' -exec basename {} \;) )
RST=( $(find "$searchdir" -type f -iname 'readme.rst' -exec basename {} \;) )
TXT=( $(find "$searchdir" -type f -iname 'readme.txt' -exec basename {} \;) )
outputdir=$PWD/../patched-fonts/$filename/
outputlocation=$outputdir/$infofilename
[[ -d "$outputdir" ]] || mkdir -p "$outputdir"
echo "RST:"
echo $RST
echo "end"
#exit
# clear output file (needed for multiple runs or updates):
> $outputlocation
> "$outputlocation"
if [ $RST ];
if [ "${RST[0]}" ];
then
echo "pwd/filename $PWD/$filename"
echo "found RST"
pandoc "$PWD/$searchdir/$RST" --from=rst --to=markdown --output=$outputlocation
#echo "pandoc $PWD/$filename/$RST --from=rst --to=markdown --output=$outputlocation"
#echo "pwd $PWD"
cat $PWD/../source/readme-per-directory-addendum.md >> $outputlocation
elif [ $TXT ];
pandoc "$PWD/$searchdir/${RST[0]}" --from=rst --to=markdown --output="$outputlocation"
cat "$PWD/../source/readme-per-directory-addendum.md" >> "$outputlocation"
elif [ "${TXT[0]}" ];
then
echo "pwd/filename $PWD/$searchdir"
echo "found TXT"
echo "nothing to do for conversion, just copy as markdown"
cp $PWD/$searchdir/$TXT $outputlocation
#echo "pwd $PWD"
cat $PWD/../source/readme-per-directory-addendum.md >> $outputlocation
cp "$PWD/$searchdir/${TXT[0]}" "$outputlocation"
cat "$PWD/../source/readme-per-directory-addendum.md" >> "$outputlocation"
else
echo "pwd/filename $PWD/$searchdir"
# else doesnt copy parent dir. somehow do this...
echo "did not find RST nor TXT"
cat $PWD/../source/readme-per-directory-addendum.md >> $outputlocation
cat "$PWD/../source/readme-per-directory-addendum.md" >> "$outputlocation"
fi
done