Version 0.2.10

This commit is contained in:
Cyrille L 2022-08-24 12:38:38 +02:00
parent 1237337a9d
commit 6874ed7ade
12 changed files with 120 additions and 35 deletions

View File

@ -6,6 +6,15 @@ STL: Statique Littérateur
- Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md - Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md
- License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE - License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE
## [0.2.10]
### read
- Better read option + autocompletion
### db
- added to autocompletion
- new option: sidebar. to check all article's sort from sidebar
## [0.2.9] ## [0.2.9]
- fix a bug in log when using remove wip,www (ARTICLE) - fix a bug in log when using remove wip,www (ARTICLE)
- other little corrections - other little corrections

View File

@ -1,5 +1,5 @@
Package: estl Package: estl
Version: 0.2.9 Version: 0.2.10
Section: custom Section: custom
Priority: optional Priority: optional
Architecture: all Architecture: all

View File

@ -9,7 +9,7 @@
#------------ #------------
# funny stats # funny stats
#------------ #------------
# lines: 61 # lines: 59
# functions: 0 # functions: 0
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
@ -30,10 +30,8 @@ stl_dir_log="/var/log/stl"
# Register main scripts files # Register main scripts files
#====================================================================== #======================================================================
stl_file_help_args="$stl_dir_help/help" stl_file_help_args="$stl_dir_help/help"
stl_file_log="$stl_dir_log/stl.log" stl_file_log="$stl_dir_log/stl.log"
stl_file_last_log="$stl_dir_log/last_stl.log" stl_file_last_log="$stl_dir_log/last_stl.log"
stl_file_pwd_conf='.stl.conf' stl_file_pwd_conf='.stl.conf'

View File

@ -6,6 +6,15 @@ STL: Statique Littérateur
- Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md - Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md
- License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE - License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE
## [0.2.10]
### read
- Better read option + autocompletion
### db
- added to autocompletion
- new option: sidebar. to check all article's sort from sidebar
## [0.2.9] ## [0.2.9]
- fix a bug in log when using remove wip,www (ARTICLE) - fix a bug in log when using remove wip,www (ARTICLE)
- other little corrections - other little corrections

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# Version: 0.2.9 # Version: 0.2.10
# Name: Statique Littérateur # Name: Statique Littérateur
# Type: Executable # Type: Executable
# Description: Static website generator # Description: Static website generator
@ -13,8 +13,8 @@
# funny stats # funny stats
#------------ #------------
# scripts files: 14 # scripts files: 14
# app lines: 4654 # app lines: 4712
# app functions: 105 # app functions: 106
# lines: 146 # lines: 146
# functions: 4 # functions: 4
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
@ -45,8 +45,8 @@ if__file() {
&& exit && exit
case "$2" in case "$2" in
source) source "$1" ;; source) source "$1" ;;
read) cat "$1";exit ;; read) cat "$sl" "$1" ;;
esac esac
} }
@ -103,8 +103,8 @@ if__file "$stl_dir_scripts/wip__article" source
# Check Options in each dedicated files scripts # Check Options in each dedicated files scripts
#====================================================================== #======================================================================
case "$1" in case "$1" in
help|-h|--help) if__file "$stl_file_help_args" read ;; help|-h|--help) if__file "$stl_file_help_args" read;exit ;;
readme) if__file "$stl_dir_help/README.md" read ;; readme) if__file "$stl_dir_help/README.md" read;exit ;;
license) printf '%s %s\n' \ license) printf '%s %s\n' \
"# GNU AFFERO GENERAL PUBLIC LICENSE" \ "# GNU AFFERO GENERAL PUBLIC LICENSE" \
"Version 3, 19 November 2007";exit ;; "Version 3, 19 November 2007";exit ;;

View File

@ -9,8 +9,8 @@
#------------ #------------
# funny stats # funny stats
#------------ #------------
# lines: 265 # lines: 293
# functions: 10 # functions: 11
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
#********************************************************************** #**********************************************************************
@ -40,12 +40,14 @@ domain
help help
license license
log log
read
version version
EOL EOL
else else
cat <<EOL cat <<EOL
check check
db
domain domain
edit edit
help help
@ -62,17 +64,38 @@ EOL
fi fi
} }
#----------------------------------------------------------------------
# Specifics for db
#----------------------------------------------------------------------
_stl_arg_db() {
[[ $nodomain ]] && return 0
cat << EOL
sidebar
$(_stl_articles)
EOL
}
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# Specifics for edit and read # Specifics for edit and read
#---------------------------------------------------------------------- #----------------------------------------------------------------------
_stl_arg_editread() { _stl_arg_editread() {
[[ $nodomain ]] && return 0 if [[ "${COMP_WORDS[COMP_CWORD-1]}" == "read" ]];then
cat << EOL
license
EOL
fi
if [[ $nodomain ]];then
return 0
else
cat << EOL cat << EOL
conf conf
sidebar sidebar
$(_stl_articles) $(_stl_articles)
EOL EOL
fi
} }
@ -194,6 +217,11 @@ _stl_completions() {
COMPREPLY=( $(compgen -W "$(_stl_arg_editread)" -- ${cur}) ) COMPREPLY=( $(compgen -W "$(_stl_arg_editread)" -- ${cur}) )
return 0 return 0
;; ;;
db)
COMPREPLY=( $(compgen -W "$(_stl_arg_db)" -- ${cur}) )
return 0
;;
sidebar) sidebar)
COMPREPLY=( $(compgen -W "$(_stl_arg_sidebar)" -- ${cur}) ) COMPREPLY=( $(compgen -W "$(_stl_arg_sidebar)" -- ${cur}) )

View File

@ -6,6 +6,15 @@ STL: Statique Littérateur
- Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md - Changelog: https://git.a-lec.org/echolib/stl/-/blob/main/CHANGELOG.md
- License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE - License: https://git.a-lec.org/echolib/stl/-/blob/main/LICENSE
## [0.2.10]
### read
- Better read option + autocompletion
### db
- added to autocompletion
- new option: sidebar. to check all article's sort from sidebar
## [0.2.9] ## [0.2.9]
- fix a bug in log when using remove wip,www (ARTICLE) - fix a bug in log when using remove wip,www (ARTICLE)
- other little corrections - other little corrections

View File

@ -9,7 +9,7 @@
#------------ #------------
# funny stats # funny stats
#------------ #------------
# lines: 252 # lines: 258
# functions: 8 # functions: 8
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
@ -72,9 +72,9 @@ find "$dir_target" -type d -empty -delete
# Remove www hash to DB # Remove www hash to DB
db__srv_status_hash "$srv" Unset db__srv_status_hash "$srv" Unset
} }
#====================================================================== #======================================================================
# Remove this file # Remove this file
# $1: file # $1: file
@ -88,6 +88,7 @@ if [[ -f "$1" ]];then
fi fi
} }
#====================================================================== #======================================================================
# Argument read # Argument read
# $1: read # $1: read
@ -97,15 +98,19 @@ read__OPTIONS() {
! [[ "$2" ]] \ ! [[ "$2" ]] \
&& noarg "Cannot be empty" && noarg "Cannot be empty"
sl="-n"
case "$2" in case "$2" in
*".stl") article__hash "$2" ;; *".stl") article__hash "$2" ;;
conf) domain__get;uri_article="$stl_file_pwd_conf" ;; conf) domain__get;uri_article="$stl_file_pwd_conf" ;;
sidebar) domain__get;uri_article="$domain_file_sidebar_load" ;; sidebar) domain__get;uri_article="$domain_file_sidebar_load" ;;
license) uri_article="$stl_dir_help/LICENSE" ;; license) uri_article="$stl_dir_help/LICENSE";unset sl ;;
*) noarg "$2" ;; *) noarg "$2" ;;
esac esac
if__file "$uri_article" read if__file "$uri_article" read
if [[ $uri_article == "$stl_dir_help/LICENSE" ]];then
echo && stl license
fi
exit exit
} }
@ -165,9 +170,9 @@ awk -v end="$article_begin" \
'NR >= end {print}' \ 'NR >= end {print}' \
"$1" \ "$1" \
> "$article_tmp_post" > "$article_tmp_post"
} }
#====================================================================== #======================================================================
# Get article line for article_tmp_post. Count from begin - 1 # Get article line for article_tmp_post. Count from begin - 1
#====================================================================== #======================================================================
@ -175,6 +180,7 @@ article__line() {
ln=$(( ln + article_begin - 1 )) ln=$(( ln + article_begin - 1 ))
} }
#====================================================================== #======================================================================
# Get article hash + article_db ID from uri # Get article hash + article_db ID from uri
# $1: file *.stl from argument # $1: file *.stl from argument

View File

@ -9,7 +9,7 @@
#------------ #------------
# funny stats # funny stats
#------------ #------------
# lines: 315 # lines: 339
# functions: 7 # functions: 7
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
@ -36,6 +36,11 @@ db__OPTIONS() {
''|list) ''|list)
db__list db__list
;; ;;
sidebar)
db_sidebar=true
db__list
;;
*) *)
noarg "$2" noarg "$2"
@ -183,16 +188,27 @@ db__list() {
domain__get domain__get
db_tmp_list=`mktemp` db_tmp_list=`mktemp`
[[ "$stl_install" == "server" ]] \ [[ "$stl_install" == "server" ]] \
&& echo "NBR|ID|TITLE|ERROR|DATE|AUTHOR|CHECK|WIP|SIDEBAR|WWW" \ && echo "0|ID|TITLE|ERROR|DATE|AUTHOR|CHECK|WIP|SIDEBAR|WWW" \
>> "$db_tmp_list" \ >> "$db_tmp_list" \
|| echo "NBR|ID|TITLE|ERROR|DATE|AUTHOR|CHECK|WIP|SIDEBAR" \ || echo "0|ID|TITLE|ERROR|DATE|AUTHOR|CHECK|WIP|SIDEBAR" \
>> "$db_tmp_list" >> "$db_tmp_list"
while read -r "db_file" while read -r "db_file"
do do
((db_nbr++))
source "$db_file" source "$db_file"
if [[ $db_sidebar ]];then
if ! [[ $sidebar_position ]];then
continue
else
db_nbr=$sidebar_position
fi
else
((db_nbr++))
fi
[[ $article_chk_hash != $article_wip_hash ]] \ [[ $article_chk_hash != $article_wip_hash ]] \
&& wip_status="${CY}$article_wip_hash${NC}" \ && wip_status="${CY}$article_wip_hash${NC}" \
|| wip_status="$article_wip_hash" || wip_status="$article_wip_hash"
@ -221,11 +237,19 @@ do
done < <(ls -1 "$domain_db_articles/"*.db 2>/dev/null) done < <(ls -1 "$domain_db_articles/"*.db 2>/dev/null)
(( `cat "$db_tmp_list" | wc -l` > 1 )) \ if ! (( `cat "$db_tmp_list" | wc -l` > 1 ));then
&& cat "$db_tmp_list" | column -t -s'|' -o ' ' exit
rm -f "$db_rmp_list"
else
if [[ $db_sidebar ]];then
cat "$db_tmp_list" | column -t -s'|' -o' ' | sort -k1
else
cat "$db_tmp_list" | column -t -s'|' -o' '
fi
rm -f "$db_rmp_list"
fi
exit exit
} }

View File

@ -128,7 +128,7 @@ if__writeable "$PWD"
case "$set_prot" in case "$set_prot" in
Y|y) domain_protocol="https://" ;; Y|y) domain_protocol="https://" ;;
N|n) domain_protocol="http://" ;; N|n) domain_protocol="http://" ;;
*) echo "# Maybe later...";exit ;; *) echo "# Maybe later...";exit ;;
esac esac
domain_ask+="$domain_name" domain_ask+="$domain_name"
fi fi
@ -157,7 +157,7 @@ case "$domain_name" in
read -rp "$domain_ask (Y|*) ? " domain_confirm read -rp "$domain_ask (Y|*) ? " domain_confirm
case "$domain_confirm" in case "$domain_confirm" in
Y|y) true ;; Y|y) true ;;
*) echo "# Maybe later...";exit ;; *) echo "# Maybe later...";exit ;;
esac esac
;; ;;

View File

@ -131,7 +131,7 @@ sidebar__manage "$2" "$position" "$sidebar_HTML_item"
#====================================================================== #======================================================================
sidebar__manage() { sidebar__manage() {
case "$1" in case "$1" in
latest|-l) sort_arg='-k2' ;; latest|-l) sort_arg='-k2' ;;
oldest|-o) sort_arg='-k2r' ;; oldest|-o) sort_arg='-k2r' ;;
esac esac
@ -314,6 +314,6 @@ do
done <"$domain_dir_sidebar/stl.sidebar" done <"$domain_dir_sidebar/stl.sidebar"
# Create HTML sidebar # Create HTML sidebar if an article is added
[[ $sidebar_add ]] && sidebar__create_HTML [[ $sidebar_add ]] && sidebar__create_HTML
} }

View File

@ -9,7 +9,7 @@
#------------ #------------
# funny stats # funny stats
#------------ #------------
# lines: 225 # lines: 227
# functions: 6 # functions: 6
#----------------------------------------------------------------------- #-----------------------------------------------------------------------
@ -193,11 +193,13 @@ fi
echo echo
stl log clean all stl log clean all
# Create a backup of the config in db
rsync -a "$PWD/$stl_file_pwd_conf" \
"$stl_dir_db/$domain_name/$stl_file_pwd_conf.bkp"
# Re check all checked article to wirte DB # Re check all checked article to wirte DB
echo -e "\n# Database:" echo -e "\n# Database:"
update__database # Last process with exit
# Last process with exit
update__database
} }