patrickjeremic/scroller-sh

โ˜… 0Forks 0ShellGitHub โ†—Compare

README

๐Ÿ“œ Scroller.sh

A modern, sleek command output wrapper that provides real-time scrollable display with Docker-style timing and elegant borders.

โœจ Features

  • Real-time output streaming with smooth scrolling
  • Docker-style timer with decimal precision
  • Responsive design that adapts to terminal resizing
  • Elegant borders with Unicode box-drawing characters
  • Keyboard input handling with automatic cleanup
  • Configurable display size with --max-lines
  • Non-intrusive mode with --no-clear flag

๐Ÿš€ Use Case

Perfect for wrapping long-running commands in scripts where you want to:

  • Monitor build processes, deployments, or tests
  • Display streaming logs with a clean interface
  • Integrate into CI/CD pipelines or automation scripts
  • Provide visual feedback for background processes

๐Ÿ“– Usage

./scroller.sh [OPTIONS] <command> [args...]

Options

Flag Description Example
--max-lines N Limit display to N lines --max-lines 20
--max-lines=N Alternative syntax --max-lines=15
--no-clear Don't clear screen, append to existing output --no-clear

Examples

# Monitor a log file with 10 lines visible
./scroller.sh --max-lines 10 tail -f /var/log/syslog

# Run a build process without clearing the screen
./scroller.sh --no-clear --max-lines 25 npm run build

# Monitor a ping command
./scroller.sh ping google.com

# Docker container with limited output
./scroller.sh --max-lines 20 docker run ubuntu:latest apt update

๐Ÿ”ง Integration Example

Use in your scripts to wrap long-running commands:

#!/bin/bash

# Function to run Docker with scrolling output
run_docker_with_scrolling() {
    ./scroller.sh --max-lines 26 --no-clear docker run --rm \
        --privileged \
        -v "$(pwd)/output:/output" \
        my-build-container
}

# Call the function
run_docker_with_scrolling

๐ŸŽจ Visual Preview

[+] Running: docker build -t myapp .                    Building 12.3s
โ”‚ Step 1/5 : FROM node:16-alpine                                 
โ”‚  ---> 1234567890ab                                             
โ”‚ Step 2/5 : WORKDIR /app                                        
โ”‚  ---> Running in abcdef123456                                  
โ”‚  ---> fedcba654321                                             
โ”‚ Step 3/5 : COPY package*.json ./                               
โ”‚  ---> 987654321fed                                             
โ”‚ Removing intermediate container abcdef123456                   
โ”‚ Successfully built 987654321fed                                
โ”‚ Successfully tagged myapp:latest                               

๐Ÿ› ๏ธ Requirements

  • Bash 4.0+
  • Terminal with Unicode support
  • tput command (usually pre-installed)

๐Ÿ“ Notes

  • Handles Ctrl+C gracefully, forwarding signals to wrapped commands
  • Automatically cleans up temporary files
  • Preserves command exit codes
  • Optimized for minimal CPU usage during display updates

Contributors

patrickjeremic

Issues