fix: add new website + authors

This commit is contained in:
Cyrille L 2022-04-06 18:28:48 +02:00
parent 72d84c6bed
commit b42ef551ca
2 changed files with 95 additions and 94 deletions

View File

@ -35,9 +35,8 @@ esac
# Get conf # Get conf
gsl__if_file "/etc/gsl/gsl.conf" source gsl__if_file "/etc/gsl/gsl.conf" source
# Help & Logs
gsl__if_file "$gsl_dir_scripts/gsl__log_manager" source gsl__if_file "$gsl_dir_scripts/gsl__log_manager" source
gsl__if_file "/var/lib/gsl/scripts/gsl__tools" source
case "$1" in case "$1" in
help|--help|-h) help|--help|-h)
@ -58,6 +57,77 @@ case "$1" in
esac esac
exit exit
;; ;;
new|-N)
gsl__if_file "$gsl_dir_scripts/gsl__new_website" source
gsl__logs_print \
"$gsl_log_i" \
"Starting" \
"Process" \
"New Website" \
"$gsl_dir_scripts/gsl__new_website"
gsl__new_website
gsl__logs_print \
"$gsl_log_i" \
"Stopping" \
"Process" \
"New Website" \
"$gsl_dir_scripts/gsl__new_website"
[[ -f "$gsl_file_db_domains" ]] && \
[[ -d "$gsl_dir_user_posts" ]] \
&& cd "$gsl_dir_user_posts" \
&& gsl author add
exit
;;
author|-A)
gsl__find_domain
gsl__if_file "$gsl_dir_scripts/gsl__auth_manager" source
case "$2" in
"")
gsl__authors_list
;;
add)
gsl__logs_print \
"$gsl_log_i" \
"Starting" \
"Process" \
"author $2 for domain $gsl_find_domain" \
"$gsl_file_auth_ndd"
gsl__authors_add
gsl__logs_print \
"$gsl_log_i" \
"Stopping" \
"Process" \
"author $2 for domain $gsl_find_domain" \
"$gsl_file_auth_ndd"
;;
remove)
gsl__logs_print \
"$gsl_log_i" \
"Starting" \
"Process" \
"author $2 for domain $gsl_find_domain" \
"$gsl_file_auth_ndd"
gsl__authors_remove
gsl__logs_print \
"$gsl_log_i" \
"Stopping" \
"Process" \
"author $2 for domain $gsl_find_domain" \
"$gsl_file_auth_ndd"
;;
esac
exit
;;
readme) readme)
clear clear
@ -115,16 +185,11 @@ esac
#======================================================================= #=======================================================================
# Checking Dependancies # Checking Dependancies
#======================================================================= #=======================================================================
# Get Tools
gsl__if_file "/var/lib/gsl/scripts/gsl__tools" source
# Check/Create Files and Folders # Check/Create Files and Folders
gsl__create_ff gsl__create_ff
gsl__find_domain gsl__find_domain
gsl__if_file "$gsl_dir_scripts/gsl__auth_manager" source
gsl__authors_list check || exit 1 gsl__authors_list check || exit 1
gsl__if_file "$gsl_dir_scripts/gsl__new_website" source
gsl__if_file "$gsl_dir_scripts/gsl__post_checkers" source gsl__if_file "$gsl_dir_scripts/gsl__post_checkers" source
gsl__if_file "$gsl_dir_scripts/gsl__post_manager" source gsl__if_file "$gsl_dir_scripts/gsl__post_manager" source
gsl__if_file "$gsl_dir_scripts/gsl__db_manager" source gsl__if_file "$gsl_dir_scripts/gsl__db_manager" source
@ -136,72 +201,6 @@ gsl__if_file "$gsl_dir_scripts/gsl__do_commons" source
# Main # Main
#======================================================================= #=======================================================================
case "$1" in case "$1" in
author|-A)
gsl__authors_list check || exit 1
case "$2" in
"")
gsl__authors_list
;;
add)
gsl__logs_print \
"$gsl_log_i" \
"Starting" \
"Process" \
"author $2 for domain $gsl_find_domain" \
"$gsl_file_auth_ndd"
gsl__authors_add
gsl__logs_print \
"$gsl_log_i" \
"Stopping" \
"Process" \
"author $2 for domain $gsl_find_domain" \
"$gsl_file_auth_ndd"
;;
remove)
gsl__logs_print \
"$gsl_log_i" \
"Starting" \
"Process" \
"author $2 for domain $gsl_find_domain" \
"$gsl_file_auth_ndd"
gsl__authors_remove
gsl__logs_print \
"$gsl_log_i" \
"Stopping" \
"Process" \
"author $2 for domain $gsl_find_domain" \
"$gsl_file_auth_ndd"
;;
esac
;;
new|-N)
gsl__logs_print \
"$gsl_log_i" \
"Starting" \
"Process" \
"New Website" \
"$gsl_dir_scripts/gsl__new_website"
gsl__new_website
gsl__logs_print \
"$gsl_log_i" \
"Stopping" \
"Process" \
"New Website" \
"$gsl_dir_scripts/gsl__new_website"
[[ -f "$gsl_file_db_domains" ]] && \
[[ -d "$gsl_dir_user_posts" ]] \
&& cd "$gsl_dir_user_posts" \
&& gsl author add
;;
edit|-E) edit|-E)
! [[ "$2" ]] \ ! [[ "$2" ]] \
&& echo "! Missing argument: post [FILE]" \ && echo "! Missing argument: post [FILE]" \

View File

@ -11,7 +11,7 @@
# #
#======================================================================= #=======================================================================
gsl__new_website() { gsl__new_website() {
gsl__check_file "$gsl_dir_helps/gsl_infos_new_website" || return gsl_if_file "$gsl_dir_helps/gsl_infos_new_website" source
clear clear
cat $gsl_dir_helps/gsl_infos_new_website cat $gsl_dir_helps/gsl_infos_new_website
@ -39,9 +39,9 @@ gsl__check_settings $gsl_set_server || return
printf '\n%s\n %s\n' \ printf '\n%s\n %s\n' \
"# URL: www.example.com" \ "# URL: www.example.com" \
"(https:// will be added if missing or force with http://)" "(https:// will be added if missing or force with http://)"
read -rp \ read -rp \
": Website URL ? " \ ": Website URL ? " \
gsl_set_url gsl_set_url
[[ ${gsl_set_url: -1} == "/" ]] \ [[ ${gsl_set_url: -1} == "/" ]] \
&& gsl_set_url=${gsl_set_url::-1} && gsl_set_url=${gsl_set_url::-1}
@ -103,7 +103,7 @@ case "$gsl_set_user_conf" in
n|N) n|N)
gsl_save_dir_ndd="$gsl_dir_global_domains/$gsl_set_ndd" gsl_save_dir_ndd="$gsl_dir_global_domains/$gsl_set_ndd"
gsl_save_conf_ndd="$gsl_save_dir_ndd/$gsl_set_file_ndd" gsl_save_conf_ndd="$gsl_save_dir_ndd/$gsl_set_file_ndd"
gsl_ask="# Save to $gsl_save_conf_ndd ? " gsl_ask="# Save to $gsl_save_conf_ndd"
;; ;;
*) echo "! Abandon... Maybe next time" && return ;; *) echo "! Abandon... Maybe next time" && return ;;
esac esac
@ -122,9 +122,9 @@ gsl__check_settings $gsl_set_title || return
# Website Description # Website Description
#======================================================================= #=======================================================================
echo -e "\n# Description: writings about this website" echo -e "\n# Description: writings about this website"
read -rp \ read -rp \
": Website Description ? " \ ": Website Description ? " \
gsl_set_about gsl_set_about
gsl__check_settings $gsl_set_about || return gsl__check_settings $gsl_set_about || return
@ -154,7 +154,7 @@ gsl__check_settings $gsl_set_keys || return
echo -e "\n# Language: fr (or en-GB...)" echo -e "\n# Language: fr (or en-GB...)"
read -rp \ read -rp \
": Website Lang ? " \ ": Website Lang ? " \
gsl_set_lang gsl_set_lang
gsl__check_settings $gsl_set_lang || return gsl__check_settings $gsl_set_lang || return
@ -174,9 +174,9 @@ gsl__check_settings $gsl_set_cr || return
printf '\n%s\n %s\n' \ printf '\n%s\n %s\n' \
"# logo: my-logo.png" \ "# logo: my-logo.png" \
"(Put it in $gsl_save_dir_ndd/templates/)" "(Put it in $gsl_save_dir_ndd/templates/)"
read -rp \ read -rp \
": Website logo file NAME ? " \ ": Website logo file NAME ? " \
gsl_set_logo gsl_set_logo
gsl__check_settings $gsl_set_logo || return gsl__check_settings $gsl_set_logo || return
@ -186,9 +186,9 @@ gsl__check_settings $gsl_set_logo || return
printf '\n%s\n %s\n' \ printf '\n%s\n %s\n' \
"# CSS (short) Acronym: myweb !No need to end with _" \ "# CSS (short) Acronym: myweb !No need to end with _" \
"(Will create specific classes like myweb_paragraph)" "(Will create specific classes like myweb_paragraph)"
read -rp \ read -rp \
": CSS Acronym ? " \ ": CSS Acronym ? " \
gsl_set_css gsl_set_css
gsl__check_settings $gsl_set_css || return gsl__check_settings $gsl_set_css || return
@ -198,9 +198,9 @@ gsl__check_settings $gsl_set_css || return
printf '\n%s\n %s\n' \ printf '\n%s\n %s\n' \
"# Author/Compagny URL Profile: https://..." \ "# Author/Compagny URL Profile: https://..." \
"(Used for meta rel='me')" "(Used for meta rel='me')"
read -rp \ read -rp \
": Author URL Profile ? " \ ": Author URL Profile ? " \
gsl_set_auth_url gsl_set_auth_url
gsl__check_settings $gsl_set_auth_url || return gsl__check_settings $gsl_set_auth_url || return
@ -208,10 +208,12 @@ gsl__check_settings $gsl_set_auth_url || return
# Folder for Posts # Folder for Posts
#======================================================================= #=======================================================================
printf '\n%s\n %s\n %s\n' \ printf '\n%s\n %s\n %s\n' \
"# You can set here a folder for your writings' Posts" "# You can set here a folder for your writings' Posts" \
"or manually do it later or add another one later" "or manually do it later or add another one later" \
"Autocompletion /NEWFOLDER (name of choice)" "Autocompletion /NEWFOLDER (name of choice)"
read -erp ": Where will you add your files' Post ? " gsl_dir_user_posts read -erp \
": Where will you add your files' [post].gsl ? " \
gsl_dir_user_posts
#======================================================================= #=======================================================================
# Show Resume # Show Resume