>_ZSH-TRAVIS
Open the Travis CI build page for the current project without leaving the prompt. cd into a Travis-tracked repo, type tb, and the latest build log opens in your browser. The plugin detects .travis.yml, reads git config --get remote.origin.url for the upstream slug, resolves the right Travis host, and opens the URL — main page, branch builds, build log, or open PRs.
Install
# Zinit
zinit ice lucid nocompile
zinit load MenkeTechnologies/zsh-travis
# Oh My Zsh
git clone https://github.com/MenkeTechnologies/zsh-travis \
"$HOME/.oh-my-zsh/custom/plugins/zsh-travis"
# then add zsh-travis to plugins=(...) in ~/.zshrc
# Manual
git clone https://github.com/MenkeTechnologies/zsh-travis
source zsh-travis/zsh-travis.plugin.zsh
The plugin entry sets ZPWR_OPEN_CMD from getOpenCommand (platform-detected browser opener), defines the four t* aliases, then autoloads every function under autoload/ via autoload -Uz "${0:h}/autoload/"*(.:t).
Commands
Four aliases over four trav-git* functions. Every command first runs __trav_check_yml — if the repo's top level has no .travis.yml, it prints No .travis.yml file found. to stderr and does nothing.
tg → trav-git | open the project's main Travis CI page |
tb → trav-git-build | open the latest build log (appends /builds) |
tbr → trav-git-br | open the current-branch builds (appends /branches) |
tpr → trav-git-pr | open the open PR builds (appends /pull_requests) |
How URL resolution works
The three branch/build/PR verbs all delegate to trav-git with a path-suffix argument. trav-git resolves the Travis URL in three steps:
__trav_check_yml | tests $(git rev-parse --show-toplevel)/.travis.yml exists; returns non-zero (and triggers the stderr message) when it does not |
__trav_common_url | reads git config --get remote.origin.url, strips the https:// / http:// / ssh:// / git:// scheme, drops .com and .git, then appends the path suffix (/builds, /branches, /pull_requests, or empty) |
__trav_get_url | tries https://travis-ci.com/<slug> first; if a curl --head probe sees 404 Not Found, falls back to https://travis-ci.org/<slug> |
__trav_open | runs ${=ZPWR_OPEN_CMD} "$url" — the platform browser opener |
Cross-platform open command
getOpenCommand picks the right browser-launch command from $ZPWR_OS_TYPE. The result is cached in ZPWR_OPEN_CMD at source time (only when it is unset, so a value you export beforehand wins).
darwin* | open |
cygwin* | cygstart |
linux* | nohup xdg-open — or cmd.exe /c start '' when the kernel release contains microsoft (WSL) |
msys* | start '' |
| anything else | prints Platform <type> not supported and returns 1 |
Workflow
# 1. inside any Travis-tracked git repo (has .travis.yml at top level) cd ~/code/my-project # 2. open the main Travis page for the repo tg # 3. jump straight to the latest build log tb # 4. see this branch's build history tbr # 5. check the open pull-request builds tpr # outside a Travis-tracked repo, any of them is a safe no-op: # No .travis.yml file found. (on stderr)
Because the verbs fail safe with a single stderr line, the t* aliases are safe to keep bound globally — they only do something when you are in a Travis project.
Requirements
git | required — git rev-parse for the repo top level and git config --get remote.origin.url for the upstream slug |
curl | required — the .com-vs-.org host probe in __trav_get_url |
| browser opener | open (macOS) / xdg-open (Linux) / cygstart / start — selected by getOpenCommand |
.travis.yml | must exist at the repo top level or every verb is a no-op |
Troubleshooting
No .travis.yml file found. | The repo top level has no .travis.yml. The verbs gate on its presence by design — add the file, or you are not in a Travis-tracked project. |
| Nothing opens | __trav_open sends the opener's stderr to /dev/null. Confirm ZPWR_OPEN_CMD is set to a working command for your platform, or export it before sourcing the plugin. |
| Wrong Travis host | __trav_get_url probes travis-ci.com first and falls back to travis-ci.org only on a 404. A network hiccup on the probe can pick the wrong host — re-run when connectivity is stable. |
| Platform not supported | getOpenCommand only knows darwin / cygwin / linux / msys. Export ZPWR_OPEN_CMD manually for any other platform. |
Engineering report
For the full source breakdown — per-file line counts, the exact URL-rewrite each helper performs, the host-probe contract, and the zunit coverage map — see the engineering report.
Sibling plugins
Part of the MenkeTechnologies zsh plugin family — the MenkeTechnologiesMeta umbrella:
- zsh-learn — MySQL-backed flashcard / snippet store
- zsh-git-acp — git aliases + add/commit/push keybindings
- zsh-git-repo-cache — index every git repo on disk
- zsh-better-npm-completion — cache-aware
npm installcompletion - zsh-cargo-completion — live
cargocompletion - zsh-expand — spacebar expansion
- zsh-more-completions — mega completion corpus
- zsh-nginx — nginx commands + service-wrapper aliases
- zsh-sed-sub — in-place sed substitution on the command line
- zsh-sudo — ESC ESC to prepend sudo