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

Feature request: customize badge label #3

Open
waldyrious opened this issue Jan 2, 2018 · 7 comments
Open

Feature request: customize badge label #3

waldyrious opened this issue Jan 2, 2018 · 7 comments

Comments

@waldyrious
Copy link

(moved from XAMPPRocky/tokei#139)

In tldr-pages/tldr we're using the file count badge as a proxy to the number of pages in the collection. Ideally we'd want to only count files in the pages directory (requested at #2), but even with the current count, which is already a good approximation, we'd want to change the label from "Files" to "pages". A feature to provide a custom label for the badge would enable us to do that.

On a related (but independent) note, I think the label should be lowercased to match the majority of default badge labels (see e.g. https://shields.io)

@XAMPPRocky XAMPPRocky self-assigned this Jun 18, 2018
@conao3
Copy link
Contributor

conao3 commented Mar 10, 2019

For fine modification of badge, I think that you can use shields.io Dynamic badge feature. It is hard for this repository to fulfill many requests for badges.

Therefore, for example, how about designing to return JSON if not suffixing .svg? (This probably needs to prefix /b2/)

  • https://tokei.rs/b2/{github|gitlab}/{:user}/{:repo}/{:directory}?{opitons=hoge}
    returns raw JSON.
  • https://tokei.rs/b2/{github|gitlab}/{:user}/{:repo}/{:directory}.svg?{opitons=hoge}
    returns SVG badge.

options is an option for Tokei. It is supposed to specify an option to exclude something, etc.
This fix is related to #8.

I agree that the label on the badge should be the lower case. There is room for discussion on how to describe LoC, but for other labels it should be fixed as a lower case.

@XAMPPRocky
Copy link
Owner

@conao3 You can now get JSON if you supply Accept: application/json in the request header.

@rapiz1
Copy link

rapiz1 commented Aug 24, 2019

@XAMPPRocky Can you provide an URL example about how to get JSON?

@rapiz1
Copy link

rapiz1 commented Aug 24, 2019

It seems that tokei can not work with shield.io now, right?

@rapiz1
Copy link

rapiz1 commented Aug 24, 2019

Sorry for bothering.
I have figured it out. Just simply use the URL will work with shield.io.

@elliotwutingfeng
Copy link
Contributor

If you've stumbled here, custom badge labels have been implemented in #166

@XAMPPRocky
Copy link
Owner

I've yet to deploy that version, I hope to get to it soon, but will be a busy part of the year for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants