use $PAGER instead of less directly

feat: use $PAGER instead of less directly

by RTUnreal
This commit is contained in:
Peritia 2025-08-13 13:58:38 +02:00 committed by GitHub
commit d46777148e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -11,7 +11,7 @@
## nyx-tui - Version 1.2.1:
- Added better Readability for the Build log
use `less` to make it easier to scroll through the log in the TUI
~ Thanks to *rtunreal*
use $PAGER (or fallback: `less`) to make it easier to scroll through the log in the TUI
~ Thanks to *RTUnreal*

View file

@ -16,6 +16,8 @@ nix_dir="@NIX_DIR@"
version="@VERSION@"
dialog_bin="${DIALOG_BIN:-@DIALOG_BIN@}"
PAGER="${PAGER:=less}"
# Fallbacks if Nix didn't substitute
if [[ -z "${dialog_bin//@DIALOG_BIN@/}" ]]; then
# If placeholder remained, try common defaults
@ -226,7 +228,7 @@ action_view_logs() {
tmp="$(mktemp)"
lastlog="$(find "$log_dir" -type f -name '*.log' -printf '%T@ %p\n' 2>/dev/null | sort -nr | awk 'NR==1{print $2}')"
if [[ -n "${lastlog:-}" && -f "$lastlog" ]]; then
less <"$lastlog"
$PAGER <"$lastlog"
else
d_msg "No logs found in ${log_dir}"
fi