100% vibecoded initial commit

This commit is contained in:
Maciej Bator 2026-01-13 12:32:50 +01:00
commit 94ac5d4ac7
6 changed files with 294 additions and 0 deletions

16
.gitignore vendored Normal file
View File

@ -0,0 +1,16 @@
# Editor files
*~
*.swp
*.swo
.idea/
# AUR build files
*.tar.gz
*.tar.xz
pkg/
src/
*.pkg.tar.*
# Build artifacts
*.o
*.a

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 mab122
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

15
Makefile Normal file
View File

@ -0,0 +1,15 @@
PREFIX ?= /usr/local
BINDIR = $(PREFIX)/bin
.PHONY: install uninstall
install:
@echo "Installing čd to $(BINDIR)..."
@mkdir -p $(BINDIR)
@install -m 755 čd $(BINDIR)/čd
@echo "Installation complete! Run 'čd' to see the motorak."
uninstall:
@echo "Removing čd from $(BINDIR)..."
@rm -f $(BINDIR)/čd
@echo "Uninstallation complete."

18
PKGBUILD Normal file
View File

@ -0,0 +1,18 @@
# Maintainer: mab122 maciek+ceskadraha@mbator.pl
pkgname=cd-ceskadraha
pkgver=1.0.0
pkgrel=1
pkgdesc="A fun terminal animation of a Czech Railways motorak - Czech version of sl"
arch=('any')
url="https://github.com/mab122/ceskadraha"
license=('MIT')
depends=('bash' 'ncurses')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
sha256sums=('SKIP') # Update this after creating the first release
package() {
cd "${srcdir}/ceskadraha-${pkgver}"
# Install the script
install -Dm755 čd "${pkgdir}/usr/bin/čd"
}

75
README.md Normal file
View File

@ -0,0 +1,75 @@
# čd (České dráhy)
A fun terminal animation of a Czech Railways motorak (railcar) - the Czech version of the classic `sl` command.
```
___
| |___
_____________ |___|___| _______________
| ___ ___ |=|_________|==|___ ___ |
| | | | || O O | | | | | |
|_|___|__|___||___\_____/___|__|__|__|___|__|
\_O_/ \_O_/ \_______/ \_O_/ \_O_/
České dráhy - Motorák 810
```
Inspired by the legendary `sl` command, but featuring the iconic ČD Class 810/810.0 "Orchestrion" motorak.
## Installation
### From AUR (Arch Linux)
```bash
yay -S cd-czechrailways
# or
paru -S cd-czechrailways
```
### Manual Installation
```bash
git clone https://github.com/YOUR_USERNAME/ceskadráha.git
cd ceskadráha
sudo make install
```
### Manual (without make)
```bash
sudo cp čd /usr/local/bin/
sudo chmod +x /usr/local/bin/čd
```
## Usage
```bash
čd # Run the animation (left to right)
čd -r # Run in reverse (right to left)
čd -h # Show help
```
## Features
- Animated Czech Railways Class 810 motorak
- Reverse direction support
- Animated exhaust/smoke
- Terminal width aware
- Thank you message in Czech: "Děkujeme, že jste cestovali s Českými drahami!"
## Why?
Just like the original `sl` command was created to punish users who mistype `ls`, this is for Czech railway enthusiasts who want a bit of fun in their terminal. Or maybe you just really like Czech motoráks.
## Requirements
- Bash
- `tput` command (usually part of ncurses)
## License
MIT License - See LICENSE file for details
## Credits
Inspired by the classic `sl` (Steam Locomotive) command by Toyoda Masashi.

149
čd Executable file
View File

@ -0,0 +1,149 @@
#!/bin/bash
# čd - Czech motorak animation (Czech Railways version of sl)
# Usage: čd [options]
# Parse options
DELAY=0.03
REVERSE=0
while getopts "hr" opt; do
case $opt in
h)
echo "čd - Czech motorak animation"
echo "Usage: čd [-h] [-r]"
echo " -h Show this help"
echo " -r Reverse direction"
exit 0
;;
r)
REVERSE=1
;;
esac
done
# Get terminal width
COLS=$(tput cols)
# Czech motorak (ČD Class 810/810.0 "Orchestrion")
MOTORAK=(
" "
" ___ "
" | |___ "
" _____________ |___|___| _______________ "
" | ___ ___ |=|_________|==|___ ___ | "
" | | | | || O O | | | | | | "
" |_|___|__|___||___\_____/___|__|__|__|___|__| "
" \_O_/ \_O_/ \_______/ \_O_/ \_O_/ "
" "
" České dráhy - Motorák 810 "
)
# Smoke/exhaust variants
EXHAUST1=(
" ( ) ( ) "
" ( ) "
" ( ) ( ) "
)
EXHAUST2=(
" ( ) ( ) "
" ( ) "
" ( ) ( ) "
)
# Reverse the motorak if needed
if [ $REVERSE -eq 1 ]; then
# Flip the motorak horizontally
NEW_MOTORAK=()
for line in "${MOTORAK[@]}"; do
reversed=$(echo "$line" | rev)
NEW_MOTORAK+=("$reversed")
done
MOTORAK=("${NEW_MOTORAK[@]}")
fi
# Animation function
animate() {
local position=$1
local use_exhaust1=$2
# Move cursor to home position
tput cup 0 0
# Determine which exhaust to use
local exhaust
if [ $use_exhaust1 -eq 1 ]; then
exhaust=("${EXHAUST1[@]}")
else
exhaust=("${EXHAUST2[@]}")
fi
# Print exhaust lines
for line in "${exhaust[@]}"; do
if [ $REVERSE -eq 0 ]; then
# Left to right
printf "%${position}s%s" "" "$line"
tput el # Clear to end of line
echo
else
# Right to left
local spaces=$(($COLS - $position - ${#line}))
if [ $spaces -gt 0 ]; then
printf "%${spaces}s%s" "" "$line"
fi
tput el
echo
fi
done
# Print motorak lines
for line in "${MOTORAK[@]}"; do
if [ $REVERSE -eq 0 ]; then
# Left to right
printf "%${position}s%s" "" "$line"
tput el # Clear to end of line
echo
else
# Right to left
local spaces=$(($COLS - $position - ${#line}))
if [ $spaces -gt 0 ]; then
printf "%${spaces}s%s" "" "$line"
fi
tput el
echo
fi
done
}
# Main animation loop
# Clear screen and hide cursor
clear
tput civis
if [ $REVERSE -eq 0 ]; then
# Left to right
for ((pos=0; pos<=$COLS+60; pos++)); do
if [ $((pos % 2)) -eq 0 ]; then
animate $pos 1
else
animate $pos 0
fi
sleep $DELAY
done
else
# Right to left
for ((pos=$COLS+60; pos>=0; pos--)); do
if [ $((pos % 2)) -eq 0 ]; then
animate $pos 1
else
animate $pos 0
fi
sleep $DELAY
done
fi
# Show cursor and clear
tput cnorm
clear
echo "Děkujeme, že jste cestovali s Českými drahami! 🚃"