Improved the init tool.

Remove the Python cache files.
This commit is contained in:
Cotes Chung 2019-10-12 01:07:38 +08:00
parent c363d5158d
commit 3c1cb935d2

16
init.sh
View file

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Initial the categories/tags pages and for posts. # Initial the Categories/Tags pages and Lastmod for posts.
# © 2019 Cotes Chung # © 2019 Cotes Chung
# Published under MIT License # Published under MIT License
@ -19,11 +19,13 @@ fi
python _scripts/py/init_all.py python _scripts/py/init_all.py
find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
msg="Updated" msg="Updated"
if [[ ! -z $(git status categories -s) ]]; then if [[ ! -z $(git status categories -s) ]]; then
git add categories/ git add categories/
msg+=" Categories' pages" msg+=" the Categories"
CATEGORIES=true CATEGORIES=true
fi fi
@ -31,16 +33,20 @@ fi
if [[ ! -z $(git status tags -s) ]]; then if [[ ! -z $(git status tags -s) ]]; then
git add tags/ git add tags/
if [[ $CATEGORIES = true ]]; then if [[ $CATEGORIES = true ]]; then
msg+=" and" msg+=","
else
msg+=" the"
fi fi
msg+=" Tags' pages" msg+=" Tags"
TAGS=true TAGS=true
fi fi
if [[ ! -z $(git status _posts -s) ]]; then if [[ ! -z $(git status _posts -s) ]]; then
git add _posts/ git add _posts/
if [[ $CATEGORIES = true || $TAGS = true ]]; then if [[ $CATEGORIES = true || $TAGS = true ]]; then
msg+=" and" msg+=","
else
msg+=" the"
fi fi
msg+=" Lastmod" msg+=" Lastmod"
LASTMOD=true LASTMOD=true