Last active
August 31, 2015 19:51
-
-
Save huseyin/20f657c455250d081529 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/bash | |
# | |
# KONTEYNIR | |
# FROM free | |
# MAINTAINER Hüseyin Tekinaslan <[email protected]> | |
# ----- | |
# KONTEYNIR | |
set -eu | |
OPT_F=$1 | |
VIMRC=( | |
\ 'set syn=sh' | |
\ 'filetype indent on' | |
\ 'set smartindent' | |
\ 'autocmd BufRead,BufWritePre *.sh normal gg=G' | |
) | |
function preliminary() { | |
printf "maintainer: "; read maintainer; | |
printf "e-mail: "; read email; | |
cat > $"$1" <<-KONTEYNIR | |
#!/bin/bash | |
# | |
# KONTEYNIR | |
# FROM free dists | |
# MAINTAINER $maintainer <$email> | |
# ----- | |
# RUN $ rake | |
KONTEYNIR | |
} | |
while getopts :$OPT_F FLAG; do | |
case $FLAG in | |
e) # Editör Ex modda açılır. Kurulum dosyasını yazılabilir | |
# modda çalıştırmak için kullanılmalı. | |
if [ $2 = '-p' ]; then | |
# Eğer '-p' opsiyonu gelirse, dosya yazıldıktan sonra | |
# önizlenmeli. | |
preliminary $3 | |
vim -c "${VIMRC[0]}" -c "${VIMRC[1]}" -c "${VIMRC[2]}" $3 | |
clear | |
sleep 1.2 | |
pygmentize $3 | more | |
exit 1 | |
else | |
preliminary $2 | |
vim -c "${VIMRC[0]}" -c "${VIMRC[1]}" -c "${VIMRC[2]}" $2 | |
exit 1 | |
fi | |
;; | |
p) # Editör önizleme modunda açılır. | |
pygmentize $2 | more | |
exit 1 | |
;; | |
?) echo "-$FLAG operantı tanınmıyor" | |
exit 1 | |
;; | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment