From b08a43fac3fc55e9a70a815949c9ae6a05d2b2a8 Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Sun, 9 Jun 2024 18:17:04 +0300 Subject: [PATCH] Code cleanup --- jilo | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/jilo b/jilo index 2e9b115..6ad7eaa 100755 --- a/jilo +++ b/jilo @@ -93,7 +93,13 @@ DELETE FROM conferences; DELETE FROM participants; DELETE FROM state;" -help="Usage:\n\t$0 [OPTION]\nOptions:\n\t--create-db|-d - create the database\n\t--flush|-f - flush the tables\n\t--check|-c - check for new data\n\t--parse|-p [-v] - parse the logs [verbosely]" +help="Usage: + $0 [OPTION] + Options: + --create-db|-d - create the database + --flush|-f - flush the tables + --check|-c [-v] - check for new data [verbosely] + --parse|-p [-v] - parse the logs [verbosely]" ### @@ -482,20 +488,22 @@ case "$cmd" in exit 0 fi - # report - echo "Last file: $last_file" - echo "Last filetime: $last_filetime" - echo "Last inode: $last_inode" - echo "Last size: $last_size" - echo "Last processed position: $last_pos" - echo "Current filetime: $current_filetime" - echo "Current inode: $current_inode" - echo "Current size: $current_size" + echo "File: $last_file" + # verbose report + if [[ $verbose == true ]]; then + echo -e "Last filetime:\t$last_filetime" | expand -t 30 + echo -e "Current filetime:\t$current_filetime" | expand -t 30 + echo -e "Last inode:\t$last_inode" | expand -t 30 + echo -e "Current inode:\t$current_inode" | expand -t 30 + echo -e "Last size:\t$last_size" | expand -t 30 + echo -e "Current size:\t$current_size" | expand -t 30 + echo -e "Last processed position:\t$last_pos" | expand -t 30 + fi if [[ "$last_inode" == "$current_inode" && "$current_size" -lt "$last_pos" && -f "$ROTATED_LOGFILE" ]]; then - echo "Log file has rotated." + echo -n "Log file has rotated. " else - echo "Log file has not rotated." + echo -n "Log file has not rotated. " fi if [[ "$current_filetime" -ne "$last_filetime" || "$current_size" -ne "$last_size" ]]; then