Commit graph

5437 commits

Author SHA1 Message Date
Tom Scanlan aee8c75410
bug: corruption when killed while writing 2023-10-01 08:29:24 -04:00
bors 0b6cc3c75f Auto merge of #12732 - tompscanlan:12576-registry-error-msg, r=epage
more specific registry index not found msg

### What does this PR try to resolve?

covers #12576

### How should we test and review this PR?

test covers exact text, so a review and passing tests.
2023-09-25 17:41:03 +00:00
Tom Scanlan 3393fdc528
more specific registry index not found msg 2023-09-24 15:43:18 -04:00
Eric Huss ebea09d8f4 Fix spurious errors with networking tests. 2023-09-22 13:37:26 -07:00
Weihang Lo a30d9fde98
test: verify source replacement displays registry key 2023-09-21 12:53:24 +08:00
bors 5bf83d8146 Auto merge of #12693 - hi-rustin:rustin-patch-unsupported-flags, r=epage
Better suggestion for unsupported mode in build command
2023-09-21 02:40:07 +00:00
hi-rustin 97656fbf87 Correct the helper name and the tip message 2023-09-21 10:12:03 +08:00
hi-rustin 817c2cbbb5 Better suggestion for unsupported mode in install command 2023-09-20 11:31:36 +08:00
hi-rustin 7644a4bd96 Add test for using unsupported mode in install command 2023-09-20 11:27:56 +08:00
hi-rustin ed86337492 Better suggestion for unsupported mode in build command 2023-09-20 11:24:44 +08:00
hi-rustin f262297e9a Add test for using unsupported mode in build command 2023-09-20 11:23:01 +08:00
Eric Huss c2047345bd Don't display paths with cargo clean --dry-run without --verbose
The paths themselves aren't particularly interesting.
2023-09-19 18:24:45 -07:00
Eric Huss f61d42d5ef Add a warning to cargo clean --dry-run
This makes it more consistent with other `--dry-run` commands, and
makes it clearer to the user that cargo did not do anything.
2023-09-19 18:24:45 -07:00
Eric Huss ebee726d8f Separately track files and directories removed.
The previous status line was a little awkward in the way it combined
both counts. I don't think showing the directories is particularly
interesting, so they are only displayed when no files are deleted.
2023-09-19 18:24:37 -07:00
Eric Huss 495ed7ebe2 Add a summary to cargo clean.
This adds a summary at the end when `cargo clean` finishes that displays
how many files and bytes were removed.
2023-09-19 18:16:40 -07:00
Eric Huss 45c5394703 Add a --dry-run option to cargo clean.
This adds a `--dry-run` option to have `cargo clean` display what it
would delete without actually deleting it.
2023-09-19 18:14:47 -07:00
bors f9335babbc Auto merge of #12707 - epage:spell, r=ehuss
chore: Fix typos

This is a repeat of #11561
2023-09-19 22:07:03 +00:00
Ed Page e4e10f2393 chore: Fix typos
This is a repeat of #11561
2023-09-19 15:28:48 -05:00
Angelo Ross 72dccecb19
Display only feature list or summarized on cargo add 2023-09-19 13:14:44 -03:00
Ethan Brierley 9831e83fb2 generalise suggestion on abiguous spec
Fixes #12433
2023-09-18 16:34:17 +01:00
bors 695416e8d8 Auto merge of #12660 - epage:dry, r=weihanglo
feat(cli): Add '-n' to dry-run

This came from #12638 and my many small frustrations from wanting to use `-n` and not being able to.

We do not have any existing `-n` flags for this to be confused with.

I would wager that `-n` is such an entrenched short flag in build tools that it would not make sense for us to use it with any other flag.

For a survey of where `-n` is used as a short, see https://www.gnu.org/prep/standards/html_node/Option-Table.html#Option-Table
2023-09-18 02:53:19 +00:00
bors 7149418ed3 Auto merge of #12649 - arlosi:cred-stable, r=weihanglo
feat: stabilize credential-process and registry-auth

Stabilization PR for `registry-auth` and `credential-process`.

Tracking approval of this stabilization is done in the via the FCP in [#8933](https://github.com/rust-lang/cargo/issues/8933#issuecomment-1711990123). This PR is here to help reviewers of the FCP.

* Stabilizes `registry-auth` and `credential-process`
* Makes authenticated registries require a credential provider
* Adds stable documentation for credential providers and authenticated registries

Closes #8933
Closes #10474
2023-09-18 01:17:44 +00:00
bors 41cef471d0 Auto merge of #12677 - weihanglo:registry-or-index, r=hi-rustin
refactor: use `RegistryOrIndex` enum to replace two booleans
2023-09-17 15:19:48 +00:00
Arlo Siemsen d345ca212f feat: stabilize credential-process and registry-auth 2023-09-16 22:40:45 -05:00
Weihang Lo e883054c59
test: verify publish failed with --index and the only implicit allowed registry
The message is misleading and shouldn't proceed when `--index` presents.
2023-09-16 00:48:41 +08:00
Weihang Lo e57ce13da8
refactor: --registry always conflicts with --index
Move the validation upfront to clap
2023-09-15 22:33:27 +08:00
Weihang Lo 1f172e4b76
refactor: extract registry and index arg for reuse 2023-09-15 18:30:28 +08:00
Arlo Siemsen 8f18f2bdc8 fix: emit a warning when a credential provider alias shadows a built-in provider 2023-09-14 14:33:59 -05:00
bors 5c84ce06f0 Auto merge of #12662 - Angelin01:limit-cargo-add-feature-print, r=weihanglo
Limit cargo add feature print
2023-09-14 13:19:16 +00:00
Angelo Ross 9928689d2c
Limit features printed during cargo add 2023-09-14 08:36:44 -03:00
Ed Page 82f9bd330e feat(spec): Allow partial versions when unambigious
This was proposed in #12425 to help improve usability of the existing
`cargo update` when dealing with the added workflows.
2023-09-13 22:00:00 -06:00
Ed Page 9008647ae2 test(clean): Verify spec version parsing 2023-09-13 21:59:28 -06:00
Ed Page 396298200d test(profile): Verify spec version parsing 2023-09-13 21:59:28 -06:00
Angelo Ross 3a40df85d6
Showcase output with too many features 2023-09-13 11:58:48 -03:00
Ed Page 033e06a1cc feat(cli): Add '-n' to dry-run
This came from #12638 and my many small frustrations from wanting to use
`-n` and not being able to.

We do not have any existing `-n` flags for this to be confused with.

I would wager that `-n` is such an entrenched short flag in build tools that it would
not make sense for us to use it with any other flag.

For a survey of where `-n` is used as a short, see
https://www.gnu.org/prep/standards/html_node/Option-Table.html#Option-Table
2023-09-12 13:42:00 -05:00
Jacob Finkelman dcde7eb316 move pre-release specific error message 2023-09-12 16:06:29 +00:00
loloicci 7880215265 fix error message trying patch non-existing package with prerelease version 2023-09-12 15:57:29 +00:00
loloicci c29c25be2e test error message trying patch non-existing package with prerelease version 2023-09-12 15:57:22 +00:00
Ed Page 385dfb6298 test(registry): Show current too-new schema error
This reproduces the problem in #10623.
2023-09-11 16:19:15 +00:00
Ed Page 293b71a961 test(registry): Provide more room from tests conflicting with reality 2023-09-11 16:19:15 +00:00
bors c2d26f32d3 Auto merge of #12578 - epage:help, r=weihanglo
feat(help): Add styling to help output

### What does this PR try to resolve?

Try to make `--help` output easier to parse by using terminal styling

Screenshots:

![Screenshot from 2023-09-06 09-57-11](https://github.com/rust-lang/cargo/assets/60961/61069af4-ef05-40ad-9240-fedea44d4c71)

![Screenshot from 2023-09-06 09-57-21](https://github.com/rust-lang/cargo/assets/60961/d2e69024-42aa-47c0-ad0f-24e43551b8db)

![Screenshot from 2023-09-06 09-57-36](https://github.com/rust-lang/cargo/assets/60961/e3d895e2-745f-48c6-9e84-d6fb67198d6d)

*(`nargo` is my shell script wrapping `cargo run --manifest-path cargo/Cargo.toml`)*

### How should we test and review this PR?

At this time, the only styling snapshotting library I know of is a pain to use, so testing this requires manually running the commands which I did.  Screenshots are included for easier evaluation of the general idea.

Snapshotting of the plain text output ensures we don't have accidental formatting regressions from this change since the formatting isn't as obvious from looking at the code.

### Additional information

Traditionally, cargo has disabled clap's styled output.  My assumed
reason is that cargo mixes custom help output with auto-generated and
you couldn't previously make it all styled.
Clap 4.2 allowed users to pass in strings styled using ANSI escape
codes, allowing us to pass in styled text that matches clap, unblocking this.  In clap
4.4.1, clap gained the ability for the user to override the style.

In this PR, I decided to use the new 4.4.1 feature to style clap's
output to match the rest of cargo's output.  Alternatively, we could use
a more subdue style that clap uses by default.

I used the `color-print` crate to allow something almost html-like for styling `&static str`.  Alternatively, we could directly embed the ANSI escape codes harder to get write, harder to inspect), or we could do the styling at runtime and enable the `string` feature in clap.

I decided to *not* style `Arg::help` messages because
- It might be distracting to have the descriptions lit up like a
  christmas tree
- It is a lot more work

The one exception I made was for `--list` since it is for a
psuedo-command (`...`) and I wanted to intentionally draw attention to
it.

#12593 made styling of `cargo -h` cleaner imo.
#12592 and #12594 were improvements I noticed while doing this.
2023-09-11 06:25:47 +00:00
bors 2fc85d15a5 Auto merge of #12648 - epage:lint, r=weihanglo
feat: Stabilize lints

Fixes #12115
2023-09-09 01:49:46 +00:00
bors 8bd32310f5 Auto merge of #12631 - Eh2406:strip_prefix, r=epage
Ues strip_prefix for cleaner code

### What does this PR try to resolve?

In https://github.com/rust-lang/cargo/pull/12629#pullrequestreview-1614154046 Ed pointed out how much cleaner the code can be using `strip_prefix`, so I found a bunch more places where we should be using it.

### How should we test and review this PR?

Internal refactor and test still pass.
2023-09-08 20:05:02 +00:00
Jacob Finkelman eb188831da
add a missing is:
Co-authored-by: Eric Huss <eric@huss.org>
2023-09-08 15:14:10 -04:00
Ed Page e539380512 feat: Stabilize lints
Fixes #12115
2023-09-08 10:44:00 -05:00
Arlo Siemsen 803fd6909c fix: don't print _TOKEN suggestion when not applicable
Cargo should not suggest the _TOKEN environment variable
when the cargo:token provider isn't available
2023-09-07 21:14:50 -05:00
Jacob Finkelman 44666f7377 Ues strip_prefix for cleaner code 2023-09-07 17:57:28 +00:00
Weihang Lo e575448574
refactor: flatten module path of SourceId 2023-09-07 21:06:35 +08:00
Weihang Lo b6c4e47cc0
refactor: put Source trait under cargo::sources 2023-09-07 21:06:34 +08:00
Eric Huss f49b038a3f Error out if cargo clean --doc is mixed with -p.
Currently the `-p` is ignored. This should help with any confusion
about the interaction of different flags.
https://github.com/rust-lang/cargo/issues/8790 is tracking to fix this.
2023-09-06 21:42:38 -07:00