Get the output from previous shell commands, if you use tmux
Project description
old-stdout
@readwithai - X - blog - machine-aided reading - 📖⚡️🖋️
Get the old output from shell commands, if you use tmux.
This is vibe-coded but will become less so over time.
Motivation
It is quite natural to want to do thigns with the output of a command that you just run without having to rerun. If you have programmatic access to your shell scrollback, by using tmux this allows you to get output.
Alternatives and prior work
You could collect the outputs of previous commands into files using tee.
You could use something like jupyter which matains history.
Usage
Use tmux.
oldoutwill show the output of the previous command.oldout 2shows you the output from the penultimate command (etc).outdiffshows the difference between the last two outputs
You can use --command with oldout to include the command.
Nonstandard prompts
I use a two line prompt. I therefore provide quite general features ot change the prompt parsing.
Multi-line Prompts
For prompts that span multiple lines, set PROMPT_LENGTH in ~/.config/oldout.py.
# Example two-line prompt:
# ┌─[user@host]─[/current/path]
# └─$ command here
PROMPT_RE = r"^┌─" # Match the first line of the prompt
PROMPT_LENGTH = 2 # Skip both prompt lines when extracting output
Complex Prompt Patterns
The PROMPT_RE (in ~/.config/oldout.py.) regex can handle unusual prompt formats
# Powerline/fancy prompts with symbols
PROMPT_RE = r"➜\s+\w+"
# Prompts with timestamps
PROMPT_RE = r"^\[\d{2}:\d{2}:\d{2}\]"
# Conditional prompts (different in different directories)
PROMPT_RE = r"(prod|dev|staging)>"
# Prompts with color codes (matches after ANSI sequences)
PROMPT_RE = r"\x1b\[[0-9;]*m.*\$"
About me
I am @readwithai. I create tools for reading, research and agency sometimes using the markdown editor Obsidian.
I also create a stream of tools that are related to carrying out my work.
I write about lots of things - including tools like this - on X. My blog is more about reading and research and agency.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file oldout-1.1.0.tar.gz.
File metadata
- Download URL: oldout-1.1.0.tar.gz
- Upload date:
- Size: 6.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb5610e182448409760a83c66333f1adca22eba8d98e2fafaf7910c5aa50fcbf
|
|
| MD5 |
188c2540f21b33004eddac9873f006c2
|
|
| BLAKE2b-256 |
00688eb38e9fd4032f649bf23b1914c27d8e8123a0b8a78ed49139f39f6f28ba
|
File details
Details for the file oldout-1.1.0-py3-none-any.whl.
File metadata
- Download URL: oldout-1.1.0-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79ea4165cd9ed1f1c025582b16db42f8b577e4d8229599277b6c959391963e2e
|
|
| MD5 |
95e863b48dfdb454be9b04297fe5bbdd
|
|
| BLAKE2b-256 |
747474d8fbdf4e06fa0a5c7c13a2b210fcaaceafed8bd957f1ec0169ec9af888
|