MCPcopy Index your code
hub / github.com/Necrom4/sbb-tui

github.com/Necrom4/sbb-tui @v1.15.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.15.0 ↗ · + Follow
243 symbols 716 edges 26 files 161 documented · 66%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

SBB-TUI

Unofficial TUI client for Switzerland's public transports timetables, inspired by the SBB/CFF/FFS app. Timetable data is provided by the search.ch timetable API (Swisscom Directories AG).

demo

✨ Features

  • 📍 Any station: search connections between any Swiss (and neighbouring) public transport stations
  • 🚆 Any transport: train, tram, bus, boat, cable cars (and even funiculars!)
  • 🧾 Detailed journey view with: transfers, platforms, delays, vehicle information and walk sections
  • ⚠️ Disruption warnings with a summary banner in the detail view
  • ➡️ Autocompletion of station names
  • 🚩 CLI flags to pre-fill fields for quick lookups
  • 🧭 Clickable Google Maps links for walking sections
  • ⇹ SBB brand styling with Nerd Font icons (Nerd Font recommended, Unicode fallback via --nerdfont=false)

📚 Documentation

📦 Install

Homebrew

brew install necrom4/tap/sbb-tui

Go

go install github.com/necrom4/sbb-tui@latest

AUR

yay -S sbb-tui # or equivalent AUR package manager

Nixpkgs

sbb-tui is available in nixpkgs-unstable or can be temporarily installed with:

nix-shell -p sbb-tui

[!NOTE] Or download your preferred executable from Releases directly.

Build from source

git clone https://github.com/necrom4/sbb-tui.git
cd sbb-tui
go build

[!WARNING] Due to the first release being v1.0.0, v1.X.X is considered experimental/unstable. What that mostly means is that breaking changes won't trigger a MAJOR version bump, but the CHANGELOG.md clearly documents them.

🚀 Usage

  1. Run sbb-tui
  2. Input departure and arrival locations (navigate with tab).
  3. Add optional information such as date, time, and whether those are for departure or arrival.
  4. Press Enter to view the results (navigate with arrows).

⚙️ Configuration

Add your optional config at $HOME/.config/sbb-tui/config.yaml

[!TIP] OS default config paths are also supported (such as ~/Library/Application Support/sbb-tui/config.yaml in macOS)

# default configuration
ui:
  animations: true
  nerdfont: true
  theme:
    text:            "#FFFFFF"
    textMuted:       "#888888"
    error:           "#D82E20"
    warning:         "#D82E20"
    borderFocused:   "#D82E20"
    borderUnfocused: "#484848"
    badgeKeyFg:      "#FFFFFF"
    badgeKeyBg:      "#484848"
    badgeVehicleFg:  "#FFFFFF"
    badgeVehicleBg:  "#2E3279"
    badgeModelFg:    "#FFFFFF"
    badgeModelBg:    "#7F7F7F"
    badgeCompanyFg:  "#484848"
    badgeCompanyBg:  "#FFFFFF"
    logo:            "#FFFFFF"

More themes can be found at docs/themes.md

🚩 Options

# sbb-tui --help
sbb-tui - Swiss SBB/CFF/FFS timetable app for the terminal

Usage:
  sbb-tui [flags]

Flags:
      --from string   Pre-fill departure station
      --to string     Pre-fill arrival station
      --date string   Pre-fill date [DD.MM.YYYY]
      --time string   Pre-fill time [HH:MM]
      --arrival       Set date/time as arrival instead of departure time
      --animations    Play UI animations (default true)
      --nerdfont      Use Nerd Font icons (default true)
  -v, --version       Print version and exit

❓ Why

I travel 4 hours a day and often work from the train, passing through remote regions of Switzerland where loading the SBB website alone can take up to an entire minute before I've even had a chance to search for my next connection (back when I started building this, my cellular data plan provided me with 500kb/s at most in the city). On top of that, I love open source and disliked handing data over to corporations unnecessarily, so I loved the idea of a faster solution that only fetched the necessary data, the one I requested. One day, while exploring the idea of building my first TUI, I stumbled upon the incredible Swiss public transport API and I knew I'd found the perfect occasion to start!

SBB-TUI originally ran on transport.opendata.ch and has since moved to the search.ch timetable API, which provides more data.

🍻 HELP WANTED

SBB-TUI is in constant improvement thanks to the work of many volunteers passionate about this little tool. This project is a very good playground for those who want to learn to collaborate in open source projects and improve the way they architecture their code and commit it. Whether you're a novice or a professional, don't be scared to hop on the train!

There's plenty of Issues of different complexity levels, many tagged with help wanted or good first issue. So if you're up for the challenge, read CONTRIBUTING.md, create your PR, and start coding!

Star History

Star History Chart

Core symbols most depended-on inside this repo

themeColor
called by 25
ui/styles.go
vehicleFor
called by 14
ui/icons.go
IsVehicle
called by 13
model/connection.go
IsWalk
called by 12
model/connection.go
DisruptionList
called by 8
model/connection.go
DefaultTheme
called by 8
config/config.go
FetchConnections
called by 6
api/client.go
posOfDigit
called by 6
ui/update.go

Shape

Function 143
Method 67
Struct 30
TypeAlias 3

Languages

Go100%

Modules by API surface

ui/update_test.go25 symbols
ui/shine.go25 symbols
model/connection.go24 symbols
ui/update.go18 symbols
ui/connection.go17 symbols
ui/view.go15 symbols
ui/connection_test.go13 symbols
ui/animation.go12 symbols
model/connection_test.go12 symbols
ui/model.go11 symbols
config/config.go9 symbols
api/client_test.go9 symbols

For agents

$ claude mcp add sbb-tui \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page