{"id":18808566,"url":"https://github.com/thomas-maurice/gowerline","last_synced_at":"2025-04-13T20:21:46.836Z","repository":{"id":40653057,"uuid":"382577793","full_name":"thomas-maurice/gowerline","owner":"thomas-maurice","description":"Pluggable Go server to generate Powerline segments","archived":false,"fork":false,"pushed_at":"2023-11-27T01:09:16.000Z","size":2765,"stargazers_count":5,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T15:55:43.689Z","etag":null,"topics":["daemon","golang","http-api","powerline","powerline-status"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thomas-maurice.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-07-03T09:37:52.000Z","updated_at":"2024-01-15T06:45:30.000Z","dependencies_parsed_at":"2023-11-27T01:37:45.916Z","dependency_job_id":"0c764c1f-2a8d-4f1c-a6d3-36636faf0a73","html_url":"https://github.com/thomas-maurice/gowerline","commit_stats":{"total_commits":92,"total_committers":2,"mean_commits":46.0,"dds":0.07608695652173914,"last_synced_commit":"549fc591750fb844c7f041927296407d41169604"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-maurice%2Fgowerline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-maurice%2Fgowerline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-maurice%2Fgowerline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomas-maurice%2Fgowerline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomas-maurice","download_url":"https://codeload.github.com/thomas-maurice/gowerline/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248776209,"owners_count":21159742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["daemon","golang","http-api","powerline","powerline-status"],"created_at":"2024-11-07T23:13:20.247Z","updated_at":"2025-04-13T20:21:46.802Z","avatar_url":"https://github.com/thomas-maurice.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gowerline\n\nBecause Python is hard and I've always wanted to write my segments in Go.\n\n![Example](https://github.com/thomas-maurice/gowerline/blob/master/_assets/demo.gif)\n\n## What is this ?\nThis is a deamon that generates and returns Powerline segments as [described in the docs](https://powerline.readthedocs.io/en/master/develop/segments.html).\nThis project has 2 parts:\n* The daemon that runs your go code and exposes an HTTP API\n* The powerline compatible code that glues it with the `powerline-daemon`\n\n## Quick install\nYou can grab the latest version of gowerline by running the following (needs curl, jq, tar and wget)\n\n```\ncurl -sSfL https://raw.githubusercontent.com/thomas-maurice/gowerline/master/install.sh | bash\n```\n\nThen install the latest version of the python extension by running\n```\npip install -U gowerline\n```\n## How does it work ?\nThis is a pluggable segment generating system. Essentially a very simple powerline \"segment\" in the sense\nof the python class, will call a Go server that will be in charge of generating the actual segments. It allows you\nto generate data that would be too long to generate if it had to be called every time you pop a shell,\nfor instance do API calls to your favourite stock ticker or for example check the validity of an auth token\nevery other minute.\n\n## Available plugins\n\nEvery plugin has a `README.md` file at the root of their directory detailing what they do and how they work\n\n| Plugin name | Plugin description |\n|-------|-------|\n| [Bash](https://github.com/thomas-maurice/gowerline/blob/master/plugins/bash/README.md) | Renders segments that are the result of bash commands ran on a schedule |\n| [Finnhub](https://github.com/thomas-maurice/gowerline/blob/master/plugins/finnhub/README.md) | Displays financial infos about a stock ticker (or many!) that you are interested in |\n| [Vault](https://github.com/thomas-maurice/gowerline/blob/master/plugins/vault/README.md) | Gives you information about your current Hashicorp Vault token (display name, validity TTL \u0026 co) |\n| [Colourenv](https://github.com/thomas-maurice/gowerline/blob/master/plugins/colourenv/README.md) | Renders environment variables in your terminal with different colourschemes depending on values (useful to not wreck production by mistake) |\n| [Network](https://github.com/thomas-maurice/gowerline/blob/master/plugins/network/README.md) | Displays information about how your network connexion is doing |\n\n## How does it work (on my system) ?\nYou have two parts to it:\n* The powerline extension, that bridges between poweline and the Go server\n* The Go server that will bridge between the python extension and the plugins.\n\nEssentially, everytime you open a prompt, Powerline will call the various extensions of the server to\nfetch segments to render, it's as simple as this.\n\n## How do I install it ?\n```bash\n$ make install # Will install the python extension and the go binary\n$ make install-systemd # Will install the userland systemd service to start the server\n$ make install-full # will do both\n# this will remove it\n$ make uninstall\n```\n\nYou might also need to `pip install -r requirements.txt`\n\n## How do I use it ?\n### Add the segment to powerline\nThis will use the `time` plugin. In your powerline theme, add the following:\n```json\n{\n    \"function\": \"gowerline.gowerline.gwl\",\n    \"priority\": 10,\n    \"args\": {\n        \"function\": \"time\"\n    }\n}\n```\n\nEvery plugin exposes one or more `function` that you have to reference in your powerline config. This will effectively\nbe passed down to the Go code, as long as every other variable you add in this JSON.\n\nThe Gowerline config itself lives in `~/.gowerline/server.yaml`\n```yaml\ndebug: false\nlisten:\n  # use port to listen over HTTP, this is\n  # not the recommended, use the socket instead\n  # port: 6666\n  unix: ~/.gowerline/server.sock\nplugins:\n  - name: time\n    config:\n    # no config needed\n  - name: network\n    config:\n      ipService: https://checkip.amazonaws.com/\n  - name: finnhub\n    # toggle to true to actually load the plugin\n    disabled: true\n    config:\n      token: YOUR_FINHUB_TOKEN\n      tickers:\n        - CFLT\n        - AAPL\n        - FB\n  - name: vault\n    config:\n    # no config needed\n  - name: colourenv\n    config:\n      variables:\n        ENV:\n          - regex: stag\n            highlightGroup: \"information:priority\"\n          - regex: devel\n            highlightGroup: \"information:regular\"\n          - regex: prod\n            highlightGroup: \"warning:regular\"\n  - name: bash\n    config:\n      commands:\n        date:\n          cmd: \"date\"\n          interval: 30\n          highlightGroup: \"information:regular\"\n        kubeContext:\n          cmd: \"kubectl config get-contexts --no-headers | grep '*' | awk '{ print $3 }'\"\n          interval: 5\n          highlightGroup: \"gwl:kube_context\"\n```\n\n## The command line\nThe `gowerline` binary is also a commandline tool that allows you to interract with the server.\nYou need to add the binary to your path like so:\n```bash\nexport PATH=${PATH}:${HOME}/.gowerline/bin\n```\n\nYou can list plugins and get help about a specific plugin like so:\n```\n$ gowerline plugin list\n+-----------+--------------------------------+--------------------------------+---------+\n|   NAME    |          DESCRIPTION           |             AUTHOR             | VERSION |\n+-----------+--------------------------------+--------------------------------+---------+\n| bash      | Executes bash commands on      | Thomas Maurice                 | 0.0.1   |\n|           | a schedule and returns the     | \u003cthomas@maurice.fr\u003e            |         |\n|           | result                         |                                |         |\n| colourenv | Displays the content of env    | Thomas Maurice                 | 0.0.1   |\n|           | vars with colours depending on | \u003cthomas@maurice.fr\u003e            |         |\n|           | matched regexes                |                                |         |\n| finnhub   | Returns information about the  | Thomas Maurice                 | 0.0.1   |\n|           | stock price of certain tickers | \u003cthomas@maurice.fr\u003e            |         |\n| network   | Gather information about your  | Thomas Maurice                 | devel   |\n|           | network connectivity           | \u003cthomas@maurice.fr\u003e            |         |\n| time      | Shows time, it is a debug      | Thomas Maurice                 | 0.0.1   |\n|           | segment                        | \u003cthomas@maurice.fr\u003e            |         |\n| vault     | Gathers information about      | Thomas Maurice                 | 0.0.1   |\n|           | the current Vault token and    | \u003cthomas@maurice.fr\u003e            |         |\n|           | formats the result             |                                |         |\n+-----------+--------------------------------+--------------------------------+---------+\n```\n\nYou can also get help about a specific plugin, it will tell you what functions ship with a plugin and the arguments to include in your powerline json config:\n```\n./bin/gowerline-v0.0.3-15-2d4a3be-dirty-thomas_linux_amd64 plugin functions bash\n+---------------+--------------------------------+----------+----------------------------+\n| FUNCTION NAME |          DESCRIPTION           | ARGUMENT |       ARGUMENT HELP        |\n+---------------+--------------------------------+----------+----------------------------+\n| bash          | Runs bash functions at regular |          |                            |\n|               | intervals and displays the     |          |                            |\n|               | output                         |          |                            |\n|               |                                | cmd      | Name of the command to run |\n+---------------+--------------------------------+----------+----------------------------+\n```\n\nYou can also test what is going to be returned, instead of messing with a cURL command:\n```\n./bin/gowerline-v0.0.3-15-2d4a3be-dirty-thomas_linux_amd64 plugin run-function bash -a cmd=kubeContext -o json \n[\n  {\n    \"contents\": \"kubernetes\",\n    \"highlight_groups\": [\n      \"gwl:kube_context\",\n      \"information:regular\"\n    ]\n  }\n]\n```\n\n## How do I extend it ?\nGo have a look at the [example plugin](https://github.com/thomas-maurice/gowerline/blob/master/plugins/sample_plugin/README.md). It should\nbe easy to understand. Feel free to copy it in the `plugins/` directory and fill in the blanks.\n\nThe `Makefile` is designed so that if you run `make plugins` your new source will be picked up and compiled to `bin/plugins/\u003cplugin\u003e`\n\nThe plugins are complied as Go plugins (essentialy `.so` libraries) that are loaded by the main daemon.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomas-maurice%2Fgowerline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomas-maurice%2Fgowerline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomas-maurice%2Fgowerline/lists"}