#!/usr/bin/env bash # Copyright (c) 2025 640kb.neocities.org # This script is licensed under the Blue Oak Model License 1.0.0. # See: https://blueoakcouncil.org/license/1.0.0 # Changelog: # 10jul2026: Added -h and --help flags # 04may2026: Help section - warning about using a second argument # 09feb2026: Minor help section update # 10oct2025: Added CLIENT_NAME variable; removed finger dependency check # 27may2025: Minor help section updates, shebang # 07may2025: Added finger dependency check # 03may2025: Fixed client name; added nfoview check # 02may2025: Added piping support; better error handling # 01may2025: Initial release # --------------------------------------------------------------------------- CLIENT_NAME="finger" show_help() { cat << "HELP_TEXT" nview - view finger output in NFO Viewer with optional piping Usage: nview user@domain.com ["piping_command"] Examples: nview @happynetbox.com nview user@happynetbox.com nview @plan.cat "| head -n 20" nview @plan.cat "| grep -E 'Sun|Fri|Tue'" Uses: Your favorite finger client via 'CLIENT_NAME' variable Requires: nfoview (https://otsaloma.io/nfoview/) Note: Second argument is a shell pipeline (in quotes) Example: "| head -n 20" or "| grep -i text" Warning: Only use pipelines you understand Note: Output saved to a temp .nfo file (auto-deleted) HELP_TEXT echo "$(tput bold)Visit: https://640kb.neocities.org/fingerverse for more clients$(tput sgr0)" echo "" } if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then show_help exit 1 fi if ! command -v nfoview > /dev/null; then echo "Error: nfoview is not installed. Please install it first." exit 1 fi TARGET="$1" PIPING_CMD="${2:-}" tmpfile=$(mktemp /tmp/${CLIENT_NAME}_output.XXXXXX.nfo) trap 'rm -f "$tmpfile"' EXIT if [ -z "$PIPING_CMD" ]; then $CLIENT_NAME "$TARGET" > "$tmpfile" else eval "$CLIENT_NAME '$TARGET' $PIPING_CMD" > "$tmpfile" fi if [ ! -s "$tmpfile" ]; then echo "Error: No output generated (invalid target or filter?)" exit 1 fi nfoview "$tmpfile"