EmbarkStudios / EmbarkStudios/cargo-about

[Feature request] change `cargo about init` to generate the statement including user's project name.

Open
#281 0 comments 4 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
782
Forks
46
Avg merge
13m
Merged PRs (30d)
1

Description

Thank you for always maintaining `cargo-about`! This tool makes license management for cargo project much easier.

If you agree with my proposal, I can submit a PR.

## **Is your feature request related to a problem? Please describe.**
For now, the file generated by `cargo about init` includes the following lines.

```html


Third Party Licenses


This page lists the licenses of the projects used in cargo-about.



```

Users should rename `cargo-about` to their own project name, because the above means a file generated by `cargo about generate` shows `cargo-about`'s third party licenses. (Unfortunately, [lots of users do not change this part.](https://github.com/search?q=%22This+page+lists+the+licenses+of+the+projects+used+in+cargo-about.%22&type=code))

If cargo-about could do this automatically, it would be more user-friendly.

## **Describe the solution you'd like**
I propose to change `cargo about init` to generate the statement including user's project name.

```html


Third Party Licenses


This page lists the licenses of the projects used in your-project-name.



```

## **Describe alternatives you've considered**
N/A

## **How to implement**
1. Change `cargo-about` to `{{project_name}}` in `This page lists the licenses of the projects used in cargo-about.` in `default.hbs`.
2. Replace `{{project_name}}` with actual project name in `init` command.
1. Retrive actual project name using `krates::cm::MetadataCommand::new().exec()?.root_package()?.name;` [here](https://github.com/EmbarkStudios/cargo-about/blob/7ea949142cb071a60d4361ca8e0c3ff4f35f5ab9/src/cargo-about/init.rs#L23).
2. Replace `{{project_name}}` with the actual project name using Handlebars like [this](https://github.com/EmbarkStudios/cargo-about/blob/7ea949142cb071a60d4361ca8e0c3ff4f35f5ab9/src/cargo-about/generate.rs#L305).

It might be too much to use Handlebars for this. If so, it might be better to use just `str::replace` or something instead of Handlebars.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.