starship-gitlab

Crates.iostarship-gitlab
lib.rsstarship-gitlab
version0.1.4
sourcesrc
created_at2021-09-21 13:19:32.350764
updated_at2021-11-10 04:59:54.141736
descriptionGitLab Custom Command for starship.rs
homepagehttps://gitlab.com/Kores/starship-gitlab
repositoryhttps://gitlab.com/Kores/starship-gitlab
max_upload_size
id454404
size115,963
Jonathan (JonathanxD)

documentation

https://docs.rs/starship-gitlab/

README

🏭 starship-gitlab

This is not an official starship.rs project.

WIP project for showing GitLab Pipeline status on terminal with starship.rs.

Installation

Currently, starship-gitlab is only installable through cargo by running:

cargo install starship-gitlab

Installation from source:

cargo install --git https://gitlab.com/Kores/starship-gitlab

May need additional dependencies, such as git

Configuration

Update your ~/.config/starship.toml adding the following lines:

[custom.starship_gitlab]
command = "starship-gitlab"
directories = [".git"]
format = "[$output]($style)"

Example

Example

Configure your PAT token for a Gitlab host

To retrieve Pipeline information of private repos you will need to register an access token.

Personal Token

starship-gitlab token-set --host gitlab.com --personal-token TOKEN

Project Token

starship-gitlab token-set --host gitlab.com --project-token TOKEN

OAuth2 Token

starship-gitlab token-set --host gitlab.com --oauth2-token TOKEN

Caching

starship-gitlab uses sled database for caching, this reduces the amount of queries to Gitlab and avoids expressive lag in command execution.

Rate Limit

Gitlab does have a rate-limit, reported in HTTP Headers when requesting resources to Gitlab API. At the time that this documentation was written, there was rate limit of 2000 unauthenticated requests.

These values can be found here, and may change in the future.

However, caching is made to make the experience more fluid (and not because of rate limit), since requests take a bit of time (even in expressively fast connection) and affects the experience negatively.

Cache location

Cache data is stored in ~/.cache/starship-gitlab,

Cache conditions

In order to be cached, the Pipeline must be in one of those states:

  • success
  • failed
  • canceled
  • skipped

Other states are not cache, this means that a request is done to check the pipeline status everytime, which may slow down commands in projects with Gitlab remote.

Cache invalidation

Cache invalidation happens for revision when there is a new commit or there is commits that are not pushed to the remote.

Also, cache can be invalidated with --clear argument:

starship-gitlab --clear
Commit count: 29

cargo fmt