/powerline-travis-ci

A Powerline segment for fetching and showing the latest travis-ci build state

Primary LanguagePythonMIT LicenseMIT

PyPI Downloads

powerline-travis-ci

A light-hearted Powerline segment for fetching and showing the status of the last build on travis. The segment will only be shown if the current directory contains a .travis.yml file.

Keep in mind that powerline-travis-ci is in early, rapid development stage so its API/configuration format may change.

Requirements

Installation

pip install powerline-travis-ci

Activation

The very minimum required to activate the segment is to add the following to your theme JSON:

{
   "function": "powerline_travis_ci.latest_build_state",
   "args": {
        "token": API_TOKEN,
        "username": TRAVIS_USERNAME
    }
}

and the following to your colorscheme JSON (the colors can be customized):

"groups": {
      "latest_travis_build_state": {
          "fg": "gray9",
          "bg": "gray2",
          "attrs": []
    }
}

Configuration and Customization

The following optional args are available:

Argument Type Description Default
canceled_text string Text or icon to show for the canceled state "Canceled"
created_text string Text or icon to show for the created state "Created"
errored_text string Text or icon to show for the errored state "Errored"
failed_text string Text or icon to show for the failed state "Failed"
for_current_branch boolean If true the state shown is the state of the latest build of the checked out git branch false
git_path string Only used if for_current_branch is true "git"
passed_text string Text or icon to show for the passed state "Passed"
post_state_text string Text or icon to append the state.
If contains <travis_url> a clickable link to travis will be shown (if the supported by your terminal)
""
pre_state_text string Text or icon to prepend before the state.
If contains <travis_url> a clickable link to travis will be shown (if the supported by your terminal)
""
received_text string Text or icon to show for the received state "Received"
show_state_branch boolean If true the name of the git branch will be shown along the state false
started_text string Text or icon to show for the started state "Started"

Highlight Groups

In addition to the generic latest_travis_build_state group, each state can be customized independently with highlight group latest_travis_build_state_{state}.

For example,

"latest_travis_build_state_passed": {
    "fg": "white",
    "bg": "darkestgreen",
    "attrs": []
}

If a specific state does not have a highlight group then the style of "latest_travis_build_state" group will be used.

Examples

Default configuration

default

Customized text and highlight groups for "passed" and "failed" states
{
  "function": "powerline_travis_ci.latest_build_state",
  "args": {
      "token": API_TOKEN,
      "username": TRAVIS_USERNAME,
      "passed_text": "",
      "failed_text": "",
      "pre_state_text": "Travis: "
  }
}
"latest_travis_build_state": {
  "fg": "white",
  "bg": "gray2",
  "attrs": []
},
"latest_travis_build_state_passed": {
  "fg": "white",
  "bg": "darkestgreen",
  "attrs": []
},
"latest_travis_build_state_failed": {
  "fg": "white",
  "bg": "darkestred",
  "attrs": []
}

customized-passed

customized-faild

Changelog

0.1 - Nov. 6 2020

Initial release