Add support for optional --description in uv init (#10209)

## Summary
Closes #7913 by adding an optional `--description` argument to `uv init`
that fills the description field in the pyproject.toml with the supplied
arg value.

Updated `uv init` docs to describe this new optional argument.
<!-- What's the purpose of the change? What does it do, and why? -->

## Test Plan
Added snapshot tests in `uv/crates/uv/tests/it/init.rs` to test this
functionality.
<!-- How was it tested? -->

---------

Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
This commit is contained in:
Arnav Gupta
2024-12-27 19:06:51 -05:00
committed by GitHub
parent 8992f5524c
commit 3733008e6c
6 changed files with 123 additions and 4 deletions
+5 -1
View File
@@ -2568,9 +2568,13 @@ pub struct InitArgs {
///
/// By default, adds a requirement on the system Python version; use `--python` to specify an
/// alternative Python version requirement.
#[arg(long, conflicts_with_all=["app", "lib", "package", "build_backend"])]
#[arg(long, conflicts_with_all=["app", "lib", "package", "build_backend", "description"])]
pub r#script: bool,
/// Set the project description.
#[arg(long, conflicts_with = "script")]
pub description: Option<String>,
/// Initialize a version control system for the project.
///
/// By default, uv will initialize a Git repository (`git`). Use `--vcs none` to explicitly