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

Let the user set a default VCS ignore file with cargo init/new #10795

Closed
ValentinColin opened this issue Jun 28, 2022 · 1 comment
Closed

Let the user set a default VCS ignore file with cargo init/new #10795

ValentinColin opened this issue Jun 28, 2022 · 1 comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@ValentinColin
Copy link

Problem

I like the idea of having a git file in my new projects, however the one currently produced by cargo is severely lacking in customization.

Proposed Solution

Solution 1

I propose to add these options in the config.toml of cargo:

[cargo-new]
vcs-ignore-file = "path/to/default/.<vcs>ignore" # default: "" to let cargo write it himself (as it's now)

And cargo have only to copy/paste the file

Solution 2

To go further!
Having one default directory create by the user himself

[cargo-new]
template-folder = "path/to/template/folder/" # default: "" to let cargo write it by himself (as it's now)

Solution 3

To go even further!
We could create a set of default directories that we could choose with an option.
With a .cargo/templates/ folder for example:

.cargo/templates/
 ├─ default/
 │   ├─ src/main.rs
 │   ├─ .gitignore
 │   └─ Cargo.toml
 ├─ github/
 │   ├─ .github/workflows/fmt.yml
 │   ├─ src/main.rs
 │   ├─ .gitignore
 │   └─ Cargo.toml
 └─ ...
cargo new <project-name> --template "path/to/template/folder/"
# or
cargo new <project-name> --template github # Cargo could automatically search the folder 'github' in .cargo/templates/

Or something like that 😃

Notes

No response

@ValentinColin ValentinColin added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jun 28, 2022
@ehuss
Copy link
Contributor

ehuss commented Jun 28, 2022

Thanks for the suggestion! At this time, we would like to avoid adding specific settings for configuring the initial project. In the future, we would like to see cargo support customizable templates so that you can define whatever kind of structure you want (tracked in #5151). In the meantime, you might want to check out a project like cargo-generate which allows some customization.

I'm going to close in deferral to #5151.

@ehuss ehuss closed this as not planned Won't fix, can't repro, duplicate, stale Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

No branches or pull requests

2 participants