Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update git_metrics example to work properly in clean repo #5938

Open
koiralakiran1 opened this issue Apr 21, 2024 · 0 comments
Open

Update git_metrics example to work properly in clean repo #5938

koiralakiran1 opened this issue Apr 21, 2024 · 0 comments
Labels
🐛 bug Something isn't working as expected.

Comments

@koiralakiran1
Copy link

koiralakiran1 commented Apr 21, 2024

Bug Report

Many people use the examples from the docs directly, as they are somewhat of a sound goto configuration after defaults, that doesn't require much tweak. Although it's just an example, I think the example of git_metrics has (I'm guessing) "unintentional" output for clean repos. If this was intentionally kept in the docs, we can close this issue.

Current Behavior

This is the current example in git_metrics module in the documentation

# ~/.config/starship.toml

[git_metrics]
added_style = 'bold blue'
format = '[+$added]($added_style)/[-$deleted]($deleted_style) '

Looks fine when the repo is dirty (+1/-1)
image

Shows +/- even when the repo is clean
image

Expected Behavior

There should be no residual output on a clean repo, with the example configuration from the docs.
image

Possible Solution

Update example in the docs to the following:

# ~/.config/starship.toml

[git_metrics]
added_style = 'bold blue'
# Note: the wrapping ( ) will result in empty string if all the variables within it are empty
format = '([+$added]($added_style)/[-$deleted]($deleted_style) )'
@koiralakiran1 koiralakiran1 added the 🐛 bug Something isn't working as expected. label Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working as expected.
Projects
None yet
Development

No branches or pull requests

1 participant