deps-rs / deps.rs

Keep your dependencies up-to-date
https://deps.rs
Apache License 2.0
426 stars 26 forks source link

Support custom labels (to replace the hard-coded `dependencies` label) #230

Closed czy-29 closed 2 months ago

czy-29 commented 5 months ago

Support custom labels (to replace the hard-coded dependencies label)

Enet4 commented 5 months ago

Do you mean being able to replace the text presented in the dependency status badge?

czy-29 commented 5 months ago

Do you mean being able to replace the text presented in the dependency status badge?

Yep! I want to show two dependency status badges at the same time: a specific crate version, and the github repository version. If both badges show the word dependencies on the left, it will cause some confusion, so I want to customize the text on the left, which is what I call the label.

czy-29 commented 5 months ago

@Enet4 I read the code, and it seems that it is relatively simple to add this feature.

To customize the subject text on the left through URL query parameters, we only need to add a subject: Option<String> field to the server::ExtraConfig structure, and then modify the implementation of the server::views::badge::badge function.

Then when the subject parameter exists in the URL, we ignore the compact parameter and use the text specified by subject. But when subject does not exist, we still use the logic of compact to achieve API compatibility.

Finally, we update the document in README and add the description of the new subject parameter, and everything is done.

If such a change meets your expectations, I think I can implement it and submit a PR, which does not seem difficult.

czy-29 commented 5 months ago

I have submitted the PR: #231 Welcome to review!