Created
December 29, 2013 22:54
-
-
Save kiyor/8175732 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
file=$1 | |
auth=$2 | |
ext=${file#*.} | |
if [ -f ~/.vim/headers/${ext}.hd ]; then | |
cat ~/.vim/headers/${ext}.hd | |
exit 0 | |
fi | |
case "$ext" in | |
"bash" | "sh" | "python" | "perl" | "ruby") | |
comment="#" | |
;; | |
"c" | "go") | |
comment="//" | |
;; | |
"lua") | |
comment="--" | |
;; | |
*) | |
comment="#" | |
;; | |
esac | |
case "$ext" in | |
"bash" | "sh" | "perl" | "ruby") | |
pth="/bin/$ext" | |
;; | |
"lua") | |
pth="/usr/local/bin/$ext" | |
;; | |
"py") | |
pth="/usr/local/bin/python2" | |
;; | |
"go") | |
pth="" | |
;; | |
*) | |
pth="/usr/local/bin/$ext" | |
;; | |
esac | |
case "$comment" in | |
"//") | |
startC="/*" | |
endC="*/" | |
;; | |
"--") | |
startC="--[[" | |
endC="]]--" | |
comment="-." | |
;; | |
esac | |
function header(){ | |
a=$1 | |
c=$2 | |
cl=len=${#c} | |
if [[ $cl -eq 1 ]]; then | |
l=30 | |
else | |
l=15 | |
fi | |
if [ -n $startC ]; then | |
echo -n $startC | |
fi | |
for i in $(eval echo {0..$l}); do | |
echo -n $c | |
done | |
echo " | |
$c File Name : | |
$c Purpose : | |
$c Creation Date : | |
$c Last Modified : | |
$c Created By : $a | |
" | |
for i in $(eval echo {0..$l}); do | |
echo -n $c | |
done | |
if [ -n $endC ]; then | |
echo -n $endC | |
fi | |
} | |
header $auth $comment |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment