-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgobanner
More file actions
executable file
·33 lines (28 loc) · 809 Bytes
/
gobanner
File metadata and controls
executable file
·33 lines (28 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/zsh
# if figlet is not installed: sudo apt install figlet
cmtSedScript='s,^,// ,'
strSedScript="s/\`/'/g"
sed=$cmtSedScript
intro=""
outro=""
if [ "$1" = "-h" -o "$1" = "-help" ]
then
print "gobanner uses figlet to print its arguments as a banner"
print "suitable for inclusion in a Go program. By default it will"
print "generate the banner as a comment but if the first argument"
print "is '-s' or '-string' then it will generate it as a string."
print ""
print "If the string to be 'bannered' starts with a '-' it will"
print "be interpreted by figlet as a parameter, so avoid this."
exit
fi
if [ "$1" = "-s" -o "$1" = "-string" ]
then
shift
sed=$strSedScript
intro='`'
outro='`'
fi
print -n $intro
figlet -W "$*" | sed -e "$sed"
print -n $outro