Proof-of-concept Travis API v3 command-line client written in Go.
Goals:
- Speed. Go runtime boots extremely fast.
- Portability. Precompiled binaries can be distributed without dependencies.
- Extensibility. Custom
travis-<foo>subcommands are usable if in PATH.
Current design:
- Each
commands/*.gofile registers a subcommand. - A command generally uses
client.Travis()to perform API actions. - This Travis HTTP client fetches the API manifest once and performs subsequent actions by expanding the URI templates found within.
- Calls to unregistered subcommands are dispatched to
travis-<foo>executables in PATH. The following environment is provided:TRAVIS_REPO,TRAVIS_TOKEN. - The custom
travis-<foo>scripts can be implemented in any scripting language and consume thetravis apisubcommand to dispatch manual API requests.
Current supported inputs:
- Global flags:
-r/--repo SLUG,-t/--token TOKEN,--debug. - If repo slug isn't explicitly provided,
git remoteconfiguration is consulted. - If token isn't explicitly provided,
~/.travis/config.ymlis consulted.
Suggested next steps:
- Devise a help system for subcommands.
- Encapsulate error handling such as unrecognized flags or HTTP errors.
- Enable POSTing data via
travis apicommand - Add optional line-based output from
travis apiinstead of raw JSON -
travis login -
travis status -
travis show -
travis restart