mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 02:48:17 +00:00
Do not suggest --package when --backend is used, but --build-backend (#10958)
## Summary Closes #8743 ## Test Plan Snapshot tests
This commit is contained in:
parent
ae76a4b7f5
commit
d5461d8d34
3 changed files with 43 additions and 0 deletions
|
@ -2590,6 +2590,16 @@ pub struct InitArgs {
|
|||
#[arg(long, value_enum, conflicts_with_all=["script", "no_package"])]
|
||||
pub build_backend: Option<ProjectBuildBackend>,
|
||||
|
||||
/// Invalid option name for build backend.
|
||||
#[arg(
|
||||
long,
|
||||
required(false),
|
||||
action(clap::ArgAction::SetTrue),
|
||||
value_parser=clap::builder::UnknownArgumentValueParser::suggest_arg("--build-backend"),
|
||||
hide(true)
|
||||
)]
|
||||
backend: Option<String>,
|
||||
|
||||
/// Do not create a `README.md` file.
|
||||
#[arg(long)]
|
||||
pub no_readme: bool,
|
||||
|
|
|
@ -227,6 +227,7 @@ impl InitSettings {
|
|||
no_pin_python,
|
||||
no_workspace,
|
||||
python,
|
||||
..
|
||||
} = args;
|
||||
|
||||
let kind = match (app, lib, script) {
|
||||
|
|
|
@ -2253,6 +2253,38 @@ fn init_failure() -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn init_failure_with_invalid_option_named_backend() {
|
||||
let context = TestContext::new("3.12");
|
||||
uv_snapshot!(context.filters(), context.init().arg("foo").arg("--backend"), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
error: unexpected argument '--backend' found
|
||||
|
||||
tip: a similar argument exists: '--build-backend'
|
||||
|
||||
Usage: uv init [OPTIONS] [PATH]
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
uv_snapshot!(context.filters(), context.init().arg("foo").arg("--backend").arg("maturin"), @r###"
|
||||
success: false
|
||||
exit_code: 2
|
||||
----- stdout -----
|
||||
|
||||
----- stderr -----
|
||||
error: unexpected argument '--backend' found
|
||||
|
||||
tip: a similar argument exists: '--build-backend'
|
||||
|
||||
Usage: uv init [OPTIONS] [PATH]
|
||||
|
||||
For more information, try '--help'.
|
||||
"###);
|
||||
}
|
||||
#[test]
|
||||
#[cfg(feature = "git")]
|
||||
fn init_git() -> Result<()> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue