Various shell scripts for use on the RTC server. Not your official RTC stuff!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

35 lines
1.0 KiB

#! /bin/bash
# Simple browser/viewer for RTC shlog
# Author: samhunter@rawtext.club
# https://git.rawtext.club/samhunter/rtc-shell-scripts
#
# Keys:
# Esc | Ctrl-q | Ctrl-g: exit
# Down | Ctrl-j | Ctrl-n: next shlog entry
# Up | Ctrl-k | Ctrl-p: previous shlog entry
# Ctrl-D | Ctrl-U: scroll preview (down/up)
# Ctrl-x: toggle wrapping
# Enter: open current shlog entry in $EDITOR
# virtually any other: search/filtering
#
readonly PROGNAME="${0##/}"
readonly VERSION="1.0"
cd /home/papa/share/plshlog
if [ -f "$1" ]; then
cat "$1" <(ls -l "$(readlink "$1")"|\
awk '{printf("\n--\nAuthor: %s\nSource: %s\n", $3,$NF)}')
else
SHLOG="$(ls -1 |\
fzf \
--preview='Shl {}' \
--preview-window="down,80%" \
--bind 'ctrl-d:preview-half-page-down' \
--bind 'ctrl-u:preview-half-page-up' \
--bind 'ctrl-x:toggle-preview-wrap' \
--no-unicode \
--ansi \
--tiebreak="index")" && "${EDITOR:-vim}" "$SHLOG"
stty sane # fzf misbehaves on my terminal
clear
fi