You typed
sl. You meantls. The railroad thanks you for your patronage.
==== ________ ___________
_D _| |_______/ \__I_I_____===__|_________|
|(_)--- | H\________/ | | =|___ ___|
/ | | H | | | | ||_| |_||
| | | H |__--------------------| [___] |
| ________|___H__/__|_____/[][]~\_______| |
|/ | |-----------I_____I [][] [] D |=======|__
__/ =| o |=-~~\ /~~\ /~~\ /~~\ ____Y___________|__
|/-=|___|= || || || |_____/~\___/
\_/ \O=====O=====O=====O_/ \_/
Every other command punishes a typo with an error message. sl rewards it
with a steam locomotive. The entire point is maximal output for minimal
input β two mistyped letters buy you a train, and you will watch it cross
your terminal, because that is the punishment and the prize.
This is a single-file, zero-dependency Python train that takes the joke entirely too seriously: a flicker-free double-buffered renderer, wheels that actually turn, smoke that drifts and dissipates, coal cars, a whistle, and a crash mode that earns its flag.
A bare sl β the classic fumbled ls β rolls the dice on everything:
locomotive type, coal-car count, color livery (four named themes plus
fully random one-offs), and speed. Sometimes it whistles. Rarely, it flies.
Very rarely, it does not make it across.
| Event | Odds |
|---|---|
| π£ The train whistles | 1 in 4 |
| 1 in 10 | |
| π₯ The train does not arrive at the station | 1 in 20 |
Pass any flag and the dice are off β explicit options are fully deterministic, so your customizations always behave exactly as written.
- π² Surprise mode β a bare
slrandomizes the whole show, every run - π Four locomotives β Classic, Small, D51, and C51 (
-t) - π Animated wheels β a 4-frame rotation cycle on every engine
- π¨ Particle smoke β drifts behind the train and dissipates, with grayscale shading on 256-color terminals
- π Coal cars β couple up to 8 tenders behind the engine (
-n) βοΈ Flying mode β smoothstep climb with a stardust trail (-F)- π₯ Accident mode β screen shake, a spark shower, and a proper BOOM (
-a) - π£ Whistle β the train toots as it passes (
-w) - π₯οΈ Flicker-free β double-buffered frames on the alternate screen; your terminal contents come back when the train has passed
- π¨ Respectful of your eyes β honors
NO_COLORand--no-color;sl | catprints a static train instead of escape-code soup - π Terminal-aware β live resize handling, clean Ctrl+C, monotonic frame pacing that doesn't drift
- πͺΆ Zero dependencies β one file, pure Python standard library
git clone https://github.com/developtheweb/slTrain.git
cd slTrain
sudo make installThat installs to /usr/local/bin/sl. Prefer to do it by hand?
sudo cp sl /usr/local/bin/ && sudo chmod +x /usr/local/bin/slRequirements: Python 3.6+, a Unix-like terminal with ANSI escape support, and a sense of humor. Nothing else β see requirements.txt, which is proudly empty.
sudo make uninstallThe train will remember this.
You don't use sl. You commit a typo, and sl happens to you:
$ sl # π² Surprise! Random train, livery, cars, and speedBut if you insist on driving:
$ sl -t classic # The classic engine, no surprises
$ sl -l # Long train: D51 pulling coal cars
$ sl -n 8 # Maximum coal. The economy is booming
$ sl -F # Flight
$ sl -a # Tragedy
$ sl -w -c # A whistling C51
$ sl -s 2.0 # You have somewhere to be
$ sl -s 0.1 # You do not| Option | Long Form | Description |
|---|---|---|
-a |
--accident |
An accident occurs partway through |
-F |
--fly |
Make the train fly through the sky |
-l |
--long |
Use a longer train (D51 pulling coal cars) |
-c |
--C51 |
Use the C51 train type |
-t |
--type |
Locomotive type: classic, small, d51, c51 (overrides -l/-c) |
-n |
--cars |
Number of coal cars to pull, up to 8 (default: 0) |
-w |
--whistle |
Sound the whistle as the train passes |
-s |
--speed |
Animation speed multiplier, 0.1β20 (default: 1.0) |
--no-color |
Disable colors (NO_COLOR is also honored) |
|
-v |
--version |
Show version information |
-h |
--help |
Show help message |
Any flag disables surprise mode. The dice only roll for a naked typo.
For a joke, it's built like it matters:
- Double-buffered rendering. Each frame is composed into an off-screen cell buffer and emitted as a single write β no clear-screen between frames, so nothing flickers, ever.
- The alternate screen. The animation runs on the terminal's alternate
buffer, the same trick
vimandlessuse. When the train is gone, your scrollback is exactly as you left it. Like it never happened. It happened. - A particle system. Smoke, crash sparks, and stardust are particles
with velocity, drag, and gravity, aging through character ramps
(
@βOβoβ*β.) as they dissipate. - Monotonic pacing. Frame timing is anchored to a monotonic clock, so the train's speed doesn't drift with render cost or system load.
- An honest fallback. If stdout isn't a terminal, you get a static
train in plain text.
sl | catis a train.sl > file.txtis a train. There is no escaping the train, only escape codes, and those are omitted.
We've all done it β typed sl when we meant ls. Instead of
command not found, why not a gentle reminder in the form of a steam
locomotive chugging across your terminal?
- π Typing discipline through consequences β muscle memory training, enforced by rail
- π Whimsy in the command line β terminals can be fun too
- π Coworker delight β watch confusion turn to joy, then back to confusion when it crashes
- π§ Mandatory micro-breaks β the train cannot be skipped, only awaited
Can I stop the train?
Ctrl+C works and exits cleanly. Learning to type ls also works, but nobody
has ever managed it.
The train crashed. Is that a bug?
If you passed -a, that's a feature. If you didn't, that's a 1-in-20 roll
of surprise mode, and honestly, it's a little bit on you for typing sl.
Why would a train fly? 1-in-10 odds say you'll find out.
Is this compatible with the original sl?
The spirit, the D51/C51 art heritage, and the -a/-F/-l/-c flags are
all honored. The renderer, particles, and surprise mode are new.
Contributions are welcome β new locomotives, new liveries, new disasters. See the Contributing Guidelines.
git clone https://github.com/YOUR_USERNAME/slTrain.git
cd slTrain
git checkout -b feature/amazing-feature
./sl -F # test your changes
git commit -m "Add amazing feature"
git push origin feature/amazing-feature- β Star this repository β it helps others discover the train
- π Report bugs β open an issue
- π‘ Suggest features β new train types, animations, or calamities
- π Visit my website β StevenMilanese.com
- β Buy me a coffee β buymeacoffee.com/strangequark
MIT β see LICENSE. The train is free. The train has always been free.
Reverend Steven Milanese
- π Website: StevenMilanese.com
- π§ Email: contact@stevenmilanese.com
- π GitHub: @developtheweb
- πΌ LinkedIn: Connect with me
- Inspired by the original
slby Toyoda Masashi (1993), who understood that the punishment for a typo should be beautiful - The coal car art is adapted from the original
sl - Thanks to all contributors
- Special thanks to the first stargazer who inspired this update β
It's not a bug, it's a locomotive. π
Made with β€οΈ by Reverend Steven Milanese
Visit StevenMilanese.com for more projects