diff --git a/usr/local/bin/gsl b/usr/local/bin/gsl index 6e1392c..da85dce 100755 --- a/usr/local/bin/gsl +++ b/usr/local/bin/gsl @@ -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) @@ -58,6 +57,77 @@ case "$1" in esac 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 @@ -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]" \ diff --git a/var/lib/gsl/scripts/gsl__new_website b/var/lib/gsl/scripts/gsl__new_website index 8320927..035c811 100644 --- a/var/lib/gsl/scripts/gsl__new_website +++ b/var/lib/gsl/scripts/gsl__new_website @@ -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 @@ -39,9 +39,9 @@ gsl__check_settings $gsl_set_server || return printf '\n%s\n %s\n' \ "# URL: www.example.com" \ "(https:// will be added if missing or force with http://)" -read -rp \ - ": Website URL ? " \ - gsl_set_url +read -rp \ + ": Website URL ? " \ + 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) 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 @@ -122,9 +122,9 @@ gsl__check_settings $gsl_set_title || return # Website Description #======================================================================= echo -e "\n# Description: writings about this website" -read -rp \ - ": Website Description ? " \ - gsl_set_about +read -rp \ + ": Website Description ? " \ + gsl_set_about 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...)" read -rp \ ": Website Lang ? " \ - gsl_set_lang + gsl_set_lang gsl__check_settings $gsl_set_lang || return @@ -174,9 +174,9 @@ gsl__check_settings $gsl_set_cr || return printf '\n%s\n %s\n' \ "# logo: my-logo.png" \ "(Put it in $gsl_save_dir_ndd/templates/)" -read -rp \ - ": Website logo file NAME ? " \ - gsl_set_logo +read -rp \ + ": Website logo file NAME ? " \ + gsl_set_logo gsl__check_settings $gsl_set_logo || return @@ -186,9 +186,9 @@ gsl__check_settings $gsl_set_logo || return printf '\n%s\n %s\n' \ "# CSS (short) Acronym: myweb !No need to end with _" \ "(Will create specific classes like myweb_paragraph)" -read -rp \ - ": CSS Acronym ? " \ - gsl_set_css +read -rp \ + ": CSS Acronym ? " \ + gsl_set_css gsl__check_settings $gsl_set_css || return @@ -198,9 +198,9 @@ gsl__check_settings $gsl_set_css || return printf '\n%s\n %s\n' \ "# Author/Compagny URL Profile: https://..." \ "(Used for meta rel='me')" -read -rp \ - ": Author URL Profile ? " \ - gsl_set_auth_url +read -rp \ + ": Author URL Profile ? " \ + gsl_set_auth_url gsl__check_settings $gsl_set_auth_url || return @@ -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