Update post2blog.sh
This commit is contained in:
parent
310366b789
commit
52681fcbe5
11
post2blog.sh
11
post2blog.sh
@ -98,8 +98,9 @@ _title='Null'
|
|||||||
_outfile_end='Null'
|
_outfile_end='Null'
|
||||||
_savefile=0
|
_savefile=0
|
||||||
_link_string=""
|
_link_string=""
|
||||||
|
_no_questions=0
|
||||||
#get arguments from terminal
|
#get arguments from terminal
|
||||||
while getopts "hSi:l:T:c:t:s:" arg
|
while getopts "hSVi:l:T:c:t:s:" arg
|
||||||
do
|
do
|
||||||
case $arg in
|
case $arg in
|
||||||
h)
|
h)
|
||||||
@ -113,6 +114,7 @@ do
|
|||||||
dispOptionShort "-t" "Blog tags that are separated by commas. The default is/are '${_tags}'."
|
dispOptionShort "-t" "Blog tags that are separated by commas. The default is/are '${_tags}'."
|
||||||
dispOptionShort "-s" "Sub-directory of the posts. The main directory of the posts is placed under '${_posts_address}' folder of your github.io directory. The default is '${_posts_sub_address}'."
|
dispOptionShort "-s" "Sub-directory of the posts. The main directory of the posts is placed under '${_posts_address}' folder of your github.io directory. The default is '${_posts_sub_address}'."
|
||||||
dispOptionShort "-S" "Save output markdown file. The default will remove the output file after committing the blog to Github."
|
dispOptionShort "-S" "Save output markdown file. The default will remove the output file after committing the blog to Github."
|
||||||
|
dispOptionShort "-V" "Don't ask me questions."
|
||||||
dispOptionShort "-h" "Show help information."
|
dispOptionShort "-h" "Show help information."
|
||||||
exit 0;;
|
exit 0;;
|
||||||
i)
|
i)
|
||||||
@ -129,6 +131,8 @@ do
|
|||||||
_posts_sub_address=$OPTARG;;
|
_posts_sub_address=$OPTARG;;
|
||||||
S)
|
S)
|
||||||
_savefile=1;;
|
_savefile=1;;
|
||||||
|
V)
|
||||||
|
_no_questions=1;;
|
||||||
?)
|
?)
|
||||||
printf "\e[1m\e[31mError ==>\e[0m Unknow argument.\n"
|
printf "\e[1m\e[31mError ==>\e[0m Unknow argument.\n"
|
||||||
printf "Use -h option to see help information.\n"
|
printf "Use -h option to see help information.\n"
|
||||||
@ -251,8 +255,13 @@ echo "" >> ${_outfile}
|
|||||||
cat ${_tmpfile2} >> ${_outfile}
|
cat ${_tmpfile2} >> ${_outfile}
|
||||||
rm ${_tmpfile2}
|
rm ${_tmpfile2}
|
||||||
|
|
||||||
|
if [[ ${_no_questions} == 0 ]]; then
|
||||||
printf "Output file generated. Please check it. Is every thing ok? (y/n) "
|
printf "Output file generated. Please check it. Is every thing ok? (y/n) "
|
||||||
read _check_result
|
read _check_result
|
||||||
|
else
|
||||||
|
_check_result='y'
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ${_check_result} == 'y' ]]; then
|
if [[ ${_check_result} == 'y' ]]; then
|
||||||
#copy files to github.io directory. Check directory exists or not
|
#copy files to github.io directory. Check directory exists or not
|
||||||
#"${_repository_address}/${_assets_address}`date +"%Y-%m"`"
|
#"${_repository_address}/${_assets_address}`date +"%Y-%m"`"
|
||||||
|
Loading…
Reference in New Issue
Block a user