Metadata-Version: 2.4
Name: oldout
Version: 1.1.0
Summary: Get the output from previous shell commands, if you use tmux
Project-URL: Homepage, https://github.com/readwithai/oldout
Project-URL: Repository, https://github.com/readwithai/oldout
Project-URL: Issues, https://github.com/readwithai/oldout/issues
Author-email: readwithai <readwithai@example.com>
License-Expression: MIT
License-File: LICENSE
Keywords: command,history,output,shell,terminal,tmux
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Shells
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Provides-Extra: dev
Requires-Dist: black>=22.0; extra == 'dev'
Requires-Dist: mypy>=1.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# old-stdout
**@readwithai** - [X](https://x.com/readwithai) - [blog](https://readwithai.substack.com/) - [machine-aided reading](https://www.reddit.com/r/machineAidedReading/) - [📖](https://readwithai.substack.com/p/what-is-reading-broadly-defined
)[⚡️](https://readwithai.substack.com/s/technical-miscellany)[🖋️](https://readwithai.substack.com/p/note-taking-with-obsidian-much-of)

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.

* `oldout` will show the output of the previous command.
* `oldout 2` shows you the output from the penultimate command (etc).
* `outdiff` shows 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`.

```python
# 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

```python
# 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](https://readwithai.substack.com/p/what-exactly-is-obsidian).

I also create a [stream of tools](https://readwithai.substack.com/p/my-productivity-tools) that are related to carrying out my work.

I write about lots of things - including tools like this - on [X](https://x.com/readwithai).
My [blog](https://readwithai.substack.com/) is more about reading and research and agency.
