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
gsl__if_file "/etc/gsl/gsl.conf" source
# Help & Logs
gsl__if_file "$gsl_dir_scripts/gsl__log_manager" source
gsl__if_file "/var/lib/gsl/scripts/gsl__tools" source
case "$1" in
help|--help|-h)
@ -59,6 +58,77 @@ case "$1" in
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)
clear
gsl__if_file "/var/lib/gsl/README.md" read
@ -115,16 +185,11 @@ esac
#=======================================================================
# Checking Dependancies
#=======================================================================
# Get Tools
gsl__if_file "/var/lib/gsl/scripts/gsl__tools" source
# Check/Create Files and Folders
gsl__create_ff
gsl__find_domain
gsl__if_file "$gsl_dir_scripts/gsl__auth_manager" source
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_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
#=======================================================================
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)
! [[ "$2" ]] \
&& echo "! Missing argument: post [FILE]" \

View File

@ -11,7 +11,7 @@
#
#=======================================================================
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
cat $gsl_dir_helps/gsl_infos_new_website
@ -103,7 +103,7 @@ case "$gsl_set_user_conf" in
n|N)
gsl_save_dir_ndd="$gsl_dir_global_domains/$gsl_set_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 ;;
esac
@ -208,10 +208,12 @@ gsl__check_settings $gsl_set_auth_url || return
# Folder for Posts
#=======================================================================
printf '\n%s\n %s\n %s\n' \
"# You can set here a folder for your writings' Posts"
"or manually do it later or add another one later"
"# You can set here a folder for your writings' Posts" \
"or manually do it later or add another one later" \
"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