Skip to content

avdv/replay

Folders and files

NameName
Last commit message
Last commit date

Latest commit

17f893d · Dec 16, 2024
Nov 17, 2024
Sep 19, 2024
Aug 30, 2021
Sep 19, 2024
Jul 2, 2024
Sep 19, 2024
Mar 28, 2021
Jul 1, 2024
Jul 2, 2024
May 12, 2022
Sep 19, 2024
Jul 1, 2024
May 18, 2024
Sep 19, 2024
Mar 28, 2021
Mar 28, 2021
Dec 6, 2024
Sep 19, 2024
Jan 30, 2024
Dec 16, 2024
May 12, 2022
Sep 19, 2024
May 12, 2022
Dec 16, 2024
Dec 16, 2024
Jan 4, 2024
May 24, 2022
May 18, 2024
May 12, 2022
Mar 28, 2021
Jun 11, 2022
Jul 31, 2023
May 24, 2022
May 12, 2022

Repository files navigation

replay

A REPL to play with.

Wrap any command into a TUI, displaying its output in a scrollable area. Change parts of the command, hit enter to re-run the command again. Repeat.


Github workflow status

Building

You can build this project using Bazel on NixOS:

$ bazel build replay

Usage

Synopsis

$replay - interactive command line tool

Usage: replay [-v|--version] [-n|--var-name NAME] [-w|--watch FILE] 
              [-i|--from-stdin] COMMAND ARGS
  Repeatedly run a command and display its output.

Available options:
  -v,--version             output version information and exit
  -n,--var-name NAME       name of the variable to replace (default: "input")
  -w,--watch FILE          watch FILE and re-run command automatically if it
                           changes
  -i,--from-stdin          read input from stdin, pipe into program continually
  -h,--help                Show this help text

Configuration

replay reads a config file in ini format from ~/.config/replay/config.ini when it exists. This can be used to define defaults for specific commands.

Its format is like this:

; a section is matched from the command given on the command line
[cmd]
;; arguments that will be prepended to the arguments given on the command line
args = --default --arguments --query={input}
;; command to run instead of the command given on the command line
command = foocmd
;; the prompt to show before the text input
prompt = $
;; the default input of the command
input = help

Example

$ replay jq --color-output input -r wikipedia.json

screenshot

This command executes the jq tool and displays the output in a text area. Editing the expression in the input field and hitting Enter re-runs the command and displays the new output.

screenshot

Pressing Esc exits the program, and prints the last output to stdout.