From 9d30b318578f15207f139e5e8750b4db9c2196f2 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Thu, 10 Apr 2025 05:04:08 +0300 Subject: [ak-log] new flag -l: prints last line; use it on tmux-statusbar --- bin/ak-log | 1 + lib/_ak_log | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/bin/ak-log b/bin/ak-log index 0f043dd..f1c1391 100755 --- a/bin/ak-log +++ b/bin/ak-log @@ -49,6 +49,7 @@ if [ ! -z $1 ]; then case $1 in -h | --help) _ak_usage; exit;; -f | --follow) _ak_log_follow; exit;; + -l | --last) _ak_log_last_line; exit;; -g | --grep) _ak_log_grep; exit;; -m | --message) shift; _ak_log_message $*; exit;; -r | --rotate) _ak_log_rotate; exit;; diff --git a/lib/_ak_log b/lib/_ak_log index 69fab74..d08bbc8 100755 --- a/lib/_ak_log +++ b/lib/_ak_log @@ -82,6 +82,11 @@ function _ak_log_follow(){ done } +function _ak_log_last_line(){ + p="$(tail -n 1 $AK_LOGSFILE | tr -d '\n')" + _ak_log_print_log_line "$p" +} + function _ak_log_grep(){ if [ ! -z $1 ] && [ -n "$1" ] then -- cgit v1.2.3