Skip to content

anthony-S93/watching

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

watching

A simple command-line tool that retains the main feature of the linux watch command and supports scrollable output.

Features

watching adds the following features to make the watch command more user-friendly for certain use cases:

Scrollable output

Useful for situations where the output of the command cannot fit into the entire terminal window. The default behavior of watch in such cases is to keep only the characters that will fit into the screen while discarding the rest, which isn't ideal for all cases. watching circumvents that by retaining all characters of the output of the command and allowing you to scroll through them.

demo_scrolling.mp4

Vim-style scrolling is supported: to scroll down, press j; to scroll up, press k

IMPORTANT:

Please note that watching is not meant to replace the linux watch command. As such, not all features and flags of the watch command is implemented. For example, watching does not support the ability to take screenshots. For those use cases, it makes more sense to use the watch command. watching is useful for a specific use case only: when you need to scroll through the command output you're watching.

Installation

Clone this repository and run the setup script.

Requirements

Python 3.60+

Usage

Command-line syntax

watching [{-n | --interval} <time_seconds>] [{-h | --help}] [{-w | --no-wrap}] [{-t | --no-title}] <cmd> [args]

Options

  • -n, --interval

    The watch interval. Takes precedence over the WATCH_INTERVAL environment variable.

  • -w, --no-wrap

    Turn off line wrapping. Long lines will be truncated instead of wrapped to the next line.

  • -t, --no-title

    Turn off the heading normally shown at the top of the screen.

Key Controls

  • j to scroll down
  • k to scroll up
  • q to quit

Environment

The behavior of watching is affected by the following environment variables:

  • WATCH_INTERVAL

    Update interval, follows the same rules as the --interval command line option

Examples

Monitor the changes in a file

demo_monitor_file.mp4

Monitor the changes in command ouput

demo_watch_cmd.mp4