Its a beginning

I decided I should use git while working on this. If it works well huzzah, if not whatever nothing lost.  
Created header generator  gopHeader and a link printer too. I always forget to hit control v and then tab when making my gopher map
This commit is contained in:
Marcus 2021-04-17 00:18:35 +00:00
parent 03bb20ede2
commit 04683a814f
1 changed files with 82 additions and 0 deletions

82
automap.sh Normal file
View File

@ -0,0 +1,82 @@
#!/usr/pkg/bin/bash
#DOC MAINDIR specifies where the script begins to build gophermaps from.
#DOC HEADER is printed at the top of each gophermap
#DOC FOOTER is printed at the end of each gophermap
MAINDIR="$HOME/gopher"
HEADER="Welcome to my gopherspace
____ ____ _ _ _
| \| _ \| | | |
| | | | | | | | | |
|_|_|_|_| |_|\____/
"
FOOTER="
Thanks for using
_ _ ._ |_ _ ._
(_| (_) |_) | | (/_ |
_| |
"
#DOC Gopher File Codes
#DOy 0 text file
#DOC r directory
#DOC 3 error message
#DOC 5 archive file (zip, tar etc)
#DOC 7 search query
#DOC 8 telnet session
#DOC 9 binary file
#DOC g GIF image
#DOC h HTML file
#DOC i info text
#DOC I generic image file (other than GIF)
#DOC d document file (ps, pdf, doc etc)
#DOC s sound file
#DOC ; video file
#DOC c calendar file
#DOC M MIME file (mbox, emails etc)
#DOC function gophref - 3 Args filetype, selector, name
#DOC The filetypes are well defined at this URL
#DOC https://github.com/michael-lazar/hn-gopher/blob/master/hn-gopher/opt/gophernicus_2.4/READM
#DOC
function gophref(){
if [ -z "$1" ] && [ -z "$2" ];then
exit -100
elif [ -z "$2" ];then
echo "$1$2 $2";
else
echo "$1$3 $2";
fi
}
function gopHeader(){
if [ -z "$2" ];then
headerWidth=40
else
headerWidth=$2
fi
lineSegment=""
for ((i=1;i<$headerWidth; i++))
do
lineSegment="-$lineSegment"
done
echo "$lineSegment"
printf "%*s" $(((${#1}+$headerWidth)/2)) "$1"
printf '\n'
echo "$lineSegment"
}
echo "$HEADER"
gopHeader "PHLOG Posts"
gophref 0 TextFile "Big Times"
gopHeader "Looking for more? Check these out."
gophref 1 2021-04-16 "More Offgrid Fun"
gophref 0 OldStuff "Older Stuff"
echo "$FOOTER"