// ZSH-TRAVIS — OPEN TRAVIS CI BUILD PAGES // ONE KEYSTROKE FROM THE PROJECT DIR

zsh plugin · detects .travis.yml, reads remote.origin.url, opens the right Travis CI page · main / branch / build / PR · cross-platform browser opener

GitHub Issues
// Color scheme

>_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.

tgtrav-gitopen the project's main Travis CI page
tbtrav-git-buildopen the latest build log (appends /builds)
tbrtrav-git-bropen the current-branch builds (appends /branches)
tprtrav-git-propen 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_ymltests $(git rev-parse --show-toplevel)/.travis.yml exists; returns non-zero (and triggers the stderr message) when it does not
__trav_common_urlreads 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_urltries https://travis-ci.com/<slug> first; if a curl --head probe sees 404 Not Found, falls back to https://travis-ci.org/<slug>
__trav_openruns ${=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 elseprints 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

gitrequired — git rev-parse for the repo top level and git config --get remote.origin.url for the upstream slug
curlrequired — the .com-vs-.org host probe in __trav_get_url
browser openeropen (macOS) / xdg-open (Linux) / cygstart / start — selected by getOpenCommand
.travis.ymlmust 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 supportedgetOpenCommand 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: