From a70c108961e3d4cfbcbe77e50c94afb2b533c0f8 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sun, 9 Apr 2023 10:19:36 -0700 Subject: [PATCH] Stabilize `cargo logout` --- src/bin/cargo/commands/logout.rs | 5 - src/doc/man/cargo-login.md | 2 +- src/doc/man/cargo-logout.md | 57 ++++++++ src/doc/man/cargo.md | 3 + src/doc/man/generated_txt/cargo-login.txt | 2 +- src/doc/man/generated_txt/cargo-logout.txt | 115 +++++++++++++++ src/doc/man/generated_txt/cargo.txt | 3 + src/doc/src/SUMMARY.md | 1 + src/doc/src/commands/cargo-login.md | 2 +- src/doc/src/commands/cargo-logout.md | 136 ++++++++++++++++++ src/doc/src/commands/cargo.md | 3 + src/doc/src/commands/publishing-commands.md | 1 + src/doc/src/reference/config.md | 3 +- src/doc/src/reference/publishing.md | 5 + src/doc/src/reference/unstable.md | 34 ++--- src/etc/man/cargo-login.1 | 2 +- src/etc/man/cargo-logout.1 | 147 ++++++++++++++++++++ src/etc/man/cargo.1 | 4 + tests/testsuite/credential_process.rs | 4 +- tests/testsuite/logout.rs | 22 +-- 20 files changed, 493 insertions(+), 58 deletions(-) create mode 100644 src/doc/man/cargo-logout.md create mode 100644 src/doc/man/generated_txt/cargo-logout.txt create mode 100644 src/doc/src/commands/cargo-logout.md create mode 100644 src/etc/man/cargo-logout.1 diff --git a/src/bin/cargo/commands/logout.rs b/src/bin/cargo/commands/logout.rs index f1dc49cba31..0b4d8b83f4b 100644 --- a/src/bin/cargo/commands/logout.rs +++ b/src/bin/cargo/commands/logout.rs @@ -10,11 +10,6 @@ pub fn cli() -> Command { } pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult { - if !config.cli_unstable().credential_process { - config - .cli_unstable() - .fail_if_stable_command(config, "logout", 8933)?; - } let registry = args.registry(config)?; ops::registry_logout(config, registry.as_deref())?; Ok(()) diff --git a/src/doc/man/cargo-login.md b/src/doc/man/cargo-login.md index 11c663c46c6..54c823d2d8d 100644 --- a/src/doc/man/cargo-login.md +++ b/src/doc/man/cargo-login.md @@ -48,4 +48,4 @@ Take care to keep the token secret, it should not be shared with anyone else. cargo login ## SEE ALSO -{{man "cargo" 1}}, {{man "cargo-publish" 1}} +{{man "cargo" 1}}, {{man "cargo-logout" 1}}, {{man "cargo-publish" 1}} diff --git a/src/doc/man/cargo-logout.md b/src/doc/man/cargo-logout.md new file mode 100644 index 00000000000..f9c0db58cd6 --- /dev/null +++ b/src/doc/man/cargo-logout.md @@ -0,0 +1,57 @@ +# cargo-logout(1) + +## NAME + +cargo-logout --- Remove an API token from the registry locally + +## SYNOPSIS + +`cargo logout` [_options_] + +## DESCRIPTION + +This command will remove the API token from the local credential storage. +Credentials are stored in `$CARGO_HOME/credentials.toml` where `$CARGO_HOME` +defaults to `.cargo` in your home directory. + +If `--registry` is not specified, then the credentials for the default +registry will be removed (configured by +[`registry.default`](../reference/config.html#registrydefault), which defaults +to ). + +This will not revoke the token on the server. If you need to revoke the token, +visit the registry website and follow its instructions (see + to revoke the token for ). + +## OPTIONS + +### Logout Options + +{{#options}} +{{> options-registry }} +{{/options}} + +### Display Options + +{{#options}} +{{> options-display }} +{{/options}} + +{{> section-options-common }} + +{{> section-environment }} + +{{> section-exit-status }} + +## EXAMPLES + +1. Remove the default registry token: + + cargo logout + +2. Remove the token for a specific registry: + + cargo logout --registry my-registry + +## SEE ALSO +{{man "cargo" 1}}, {{man "cargo-login" 1}} diff --git a/src/doc/man/cargo.md b/src/doc/man/cargo.md index 2d71fc4d75c..3b1c62e3253 100644 --- a/src/doc/man/cargo.md +++ b/src/doc/man/cargo.md @@ -102,6 +102,9 @@ available at . {{man "cargo-login" 1}}\     Save an API token from the registry locally. +{{man "cargo-logout" 1}}\ +    Remove an API token from the registry locally. + {{man "cargo-owner" 1}}\     Manage the owners of a crate on the registry. diff --git a/src/doc/man/generated_txt/cargo-login.txt b/src/doc/man/generated_txt/cargo-login.txt index 681e3b8574c..cce8efcfbdd 100644 --- a/src/doc/man/generated_txt/cargo-login.txt +++ b/src/doc/man/generated_txt/cargo-login.txt @@ -107,5 +107,5 @@ EXAMPLES cargo login SEE ALSO - cargo(1), cargo-publish(1) + cargo(1), cargo-logout(1), cargo-publish(1) diff --git a/src/doc/man/generated_txt/cargo-logout.txt b/src/doc/man/generated_txt/cargo-logout.txt new file mode 100644 index 00000000000..db21a39b4d6 --- /dev/null +++ b/src/doc/man/generated_txt/cargo-logout.txt @@ -0,0 +1,115 @@ +CARGO-LOGOUT(1) + +NAME + cargo-logout — Remove an API token from the registry locally + +SYNOPSIS + cargo logout [options] + +DESCRIPTION + This command will remove the API token from the local credential + storage. Credentials are stored in $CARGO_HOME/credentials.toml where + $CARGO_HOME defaults to .cargo in your home directory. + + If --registry is not specified, then the credentials for the default + registry will be removed (configured by registry.default + , + which defaults to ). + + This will not revoke the token on the server. If you need to revoke the + token, visit the registry website and follow its instructions (see + to revoke the token for ). + +OPTIONS + Logout Options + --registry registry + Name of the registry to use. Registry names are defined in Cargo + config files + . If not + specified, the default registry is used, which is defined by the + registry.default config key which defaults to crates-io. + + Display Options + -v, --verbose + Use verbose output. May be specified twice for “very verbose” + output which includes extra output such as dependency warnings and + build script output. May also be specified with the term.verbose + config value + . + + -q, --quiet + Do not print cargo log messages. May also be specified with the + term.quiet config value + . + + --color when + Control when colored output is used. Valid values: + + o auto (default): Automatically detect if color support is + available on the terminal. + + o always: Always display colors. + + o never: Never display colors. + + May also be specified with the term.color config value + . + + Common Options + +toolchain + If Cargo has been installed with rustup, and the first argument to + cargo begins with +, it will be interpreted as a rustup toolchain + name (such as +stable or +nightly). See the rustup documentation + for more + information about how toolchain overrides work. + + --config KEY=VALUE or PATH + Overrides a Cargo configuration value. The argument should be in + TOML syntax of KEY=VALUE, or provided as a path to an extra + configuration file. This flag may be specified multiple times. See + the command-line overrides section + + for more information. + + -C PATH + Changes the current working directory before executing any specified + operations. This affects things like where cargo looks by default + for the project manifest (Cargo.toml), as well as the directories + searched for discovering .cargo/config.toml, for example. This + option must appear before the command name, for example cargo -C + path/to/my-project build. + + This option is only available on the nightly channel + and + requires the -Z unstable-options flag to enable (see #10098 + ). + + -h, --help + Prints help information. + + -Z flag + Unstable (nightly-only) flags to Cargo. Run cargo -Z help for + details. + +ENVIRONMENT + See the reference + + for details on environment variables that Cargo reads. + +EXIT STATUS + o 0: Cargo succeeded. + + o 101: Cargo failed to complete. + +EXAMPLES + 1. Remove the default registry token: + + cargo logout + + 2. Remove the token for a specific registry: + + cargo logout --registry my-registry + +SEE ALSO + cargo(1), cargo-login(1) + diff --git a/src/doc/man/generated_txt/cargo.txt b/src/doc/man/generated_txt/cargo.txt index 37b1e5139d9..5c0762e6038 100644 --- a/src/doc/man/generated_txt/cargo.txt +++ b/src/doc/man/generated_txt/cargo.txt @@ -95,6 +95,9 @@ COMMANDS cargo-login(1)     Save an API token from the registry locally. + cargo-logout(1) +     Remove an API token from the registry locally. + cargo-owner(1)     Manage the owners of a crate on the registry. diff --git a/src/doc/src/SUMMARY.md b/src/doc/src/SUMMARY.md index c44bc864e53..27393655985 100644 --- a/src/doc/src/SUMMARY.md +++ b/src/doc/src/SUMMARY.md @@ -82,6 +82,7 @@ * [cargo uninstall](commands/cargo-uninstall.md) * [Publishing Commands](commands/publishing-commands.md) * [cargo login](commands/cargo-login.md) + * [cargo logout](commands/cargo-logout.md) * [cargo owner](commands/cargo-owner.md) * [cargo package](commands/cargo-package.md) * [cargo publish](commands/cargo-publish.md) diff --git a/src/doc/src/commands/cargo-login.md b/src/doc/src/commands/cargo-login.md index ab13aaa7c97..e738dca0626 100644 --- a/src/doc/src/commands/cargo-login.md +++ b/src/doc/src/commands/cargo-login.md @@ -127,4 +127,4 @@ details on environment variables that Cargo reads. cargo login ## SEE ALSO -[cargo(1)](cargo.html), [cargo-publish(1)](cargo-publish.html) +[cargo(1)](cargo.html), [cargo-logout(1)](cargo-logout.html), [cargo-publish(1)](cargo-publish.html) diff --git a/src/doc/src/commands/cargo-logout.md b/src/doc/src/commands/cargo-logout.md new file mode 100644 index 00000000000..16e393b0219 --- /dev/null +++ b/src/doc/src/commands/cargo-logout.md @@ -0,0 +1,136 @@ +# cargo-logout(1) + +## NAME + +cargo-logout --- Remove an API token from the registry locally + +## SYNOPSIS + +`cargo logout` [_options_] + +## DESCRIPTION + +This command will remove the API token from the local credential storage. +Credentials are stored in `$CARGO_HOME/credentials.toml` where `$CARGO_HOME` +defaults to `.cargo` in your home directory. + +If `--registry` is not specified, then the credentials for the default +registry will be removed (configured by +[`registry.default`](../reference/config.html#registrydefault), which defaults +to ). + +This will not revoke the token on the server. If you need to revoke the token, +visit the registry website and follow its instructions (see + to revoke the token for ). + +## OPTIONS + +### Logout Options + +
+
--registry registry
+
Name of the registry to use. Registry names are defined in Cargo config +files. If not specified, the default registry is used, +which is defined by the registry.default config key which defaults to +crates-io.
+ + +
+ +### Display Options + +
+
-v
+
--verbose
+
Use verbose output. May be specified twice for “very verbose” output which +includes extra output such as dependency warnings and build script output. +May also be specified with the term.verbose +config value.
+ + +
-q
+
--quiet
+
Do not print cargo log messages. +May also be specified with the term.quiet +config value.
+ + +
--color when
+
Control when colored output is used. Valid values:

+
    +
  • auto (default): Automatically detect if color support is available on the +terminal.
  • +
  • always: Always display colors.
  • +
  • never: Never display colors.
  • +
+

May also be specified with the term.color +config value.

+ + +
+ +### Common Options + +
+ +
+toolchain
+
If Cargo has been installed with rustup, and the first argument to cargo +begins with +, it will be interpreted as a rustup toolchain name (such +as +stable or +nightly). +See the rustup documentation +for more information about how toolchain overrides work.
+ + +
--config KEY=VALUE or PATH
+
Overrides a Cargo configuration value. The argument should be in TOML syntax of KEY=VALUE, +or provided as a path to an extra configuration file. This flag may be specified multiple times. +See the command-line overrides section for more information.
+ + +
-C PATH
+
Changes the current working directory before executing any specified operations. This affects +things like where cargo looks by default for the project manifest (Cargo.toml), as well as +the directories searched for discovering .cargo/config.toml, for example. This option must +appear before the command name, for example cargo -C path/to/my-project build.

+

This option is only available on the nightly +channel and +requires the -Z unstable-options flag to enable (see +#10098).

+ + +
-h
+
--help
+
Prints help information.
+ + +
-Z flag
+
Unstable (nightly-only) flags to Cargo. Run cargo -Z help for details.
+ + +
+ + +## ENVIRONMENT + +See [the reference](../reference/environment-variables.html) for +details on environment variables that Cargo reads. + + +## EXIT STATUS + +* `0`: Cargo succeeded. +* `101`: Cargo failed to complete. + + +## EXAMPLES + +1. Remove the default registry token: + + cargo logout + +2. Remove the token for a specific registry: + + cargo logout --registry my-registry + +## SEE ALSO +[cargo(1)](cargo.html), [cargo-login(1)](cargo-login.html) diff --git a/src/doc/src/commands/cargo.md b/src/doc/src/commands/cargo.md index 54ffc46e12b..b1b07bc7021 100644 --- a/src/doc/src/commands/cargo.md +++ b/src/doc/src/commands/cargo.md @@ -102,6 +102,9 @@ available at . [cargo-login(1)](cargo-login.html)\     Save an API token from the registry locally. +[cargo-logout(1)](cargo-logout.html)\ +    Remove an API token from the registry locally. + [cargo-owner(1)](cargo-owner.html)\     Manage the owners of a crate on the registry. diff --git a/src/doc/src/commands/publishing-commands.md b/src/doc/src/commands/publishing-commands.md index 372faada216..81d440151d3 100644 --- a/src/doc/src/commands/publishing-commands.md +++ b/src/doc/src/commands/publishing-commands.md @@ -1,5 +1,6 @@ # Publishing Commands * [cargo login](cargo-login.md) +* [cargo logout](cargo-logout.md) * [cargo owner](cargo-owner.md) * [cargo package](cargo-package.md) * [cargo publish](cargo-publish.md) diff --git a/src/doc/src/reference/config.md b/src/doc/src/reference/config.md index 6578b3cc0ab..c57a45f6759 100644 --- a/src/doc/src/reference/config.md +++ b/src/doc/src/reference/config.md @@ -296,7 +296,7 @@ Cargo will search `PATH` for its executable. Configuration values with sensitive information are stored in the `$CARGO_HOME/credentials.toml` file. This file is automatically created and updated -by [`cargo login`]. It follows the same format as Cargo config files. +by [`cargo login`] and [`cargo logout`]. It follows the same format as Cargo config files. ```toml [registry] @@ -1193,6 +1193,7 @@ Sets the width for progress bar. [`cargo bench`]: ../commands/cargo-bench.md [`cargo login`]: ../commands/cargo-login.md +[`cargo logout`]: ../commands/cargo-logout.md [`cargo doc`]: ../commands/cargo-doc.md [`cargo new`]: ../commands/cargo-new.md [`cargo publish`]: ../commands/cargo-publish.md diff --git a/src/doc/src/reference/publishing.md b/src/doc/src/reference/publishing.md index 013faf6e246..98d572c346f 100644 --- a/src/doc/src/reference/publishing.md +++ b/src/doc/src/reference/publishing.md @@ -34,6 +34,10 @@ This command will inform Cargo of your API token and store it locally in your shared with anyone else. If it leaks for any reason, you should revoke it immediately. +> **Note**: The [`cargo logout`] command can be used to remove the token from +> `credentials.toml`. This can be useful if you no longer need it stored on +> the local machine. + ### Before publishing a new crate Keep in mind that crate names on [crates.io] are allocated on a first-come-first-serve @@ -264,6 +268,7 @@ request the org owner to do so. [Rust API Guidelines]: https://rust-lang.github.io/api-guidelines/ [`cargo login`]: ../commands/cargo-login.md +[`cargo logout`]: ../commands/cargo-logout.md [`cargo package`]: ../commands/cargo-package.md [`cargo publish`]: ../commands/cargo-publish.md [`categories`]: manifest.md#the-categories-field diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md index e5647eab97a..accd45d8ee8 100644 --- a/src/doc/src/reference/unstable.md +++ b/src/doc/src/reference/unstable.md @@ -101,7 +101,6 @@ Each new feature described below should explain how to use it. * [`cargo config`](#cargo-config) --- Adds a new subcommand for viewing config files. * Registries * [credential-process](#credential-process) --- Adds support for fetching registry tokens from an external authentication program. - * [`cargo logout`](#cargo-logout) --- Adds the `logout` command to remove the currently saved registry token. * [publish-timeout](#publish-timeout) --- Controls the timeout between uploading the crate and being available in the index * [registry-auth](#registry-auth) --- Adds support for authenticated registries, and generate registry authentication tokens using asymmetric cryptography. * Other @@ -905,12 +904,11 @@ The `credential-process` feature adds a config setting to fetch registry authentication tokens by calling an external process. Token authentication is used by the [`cargo login`], [`cargo publish`], -[`cargo owner`], and [`cargo yank`] commands. Additionally, this feature adds -a new `cargo logout` command. +[`cargo owner`], [`cargo yank`], and [`cargo logout`] commands. To use this feature, you must pass the `-Z credential-process` flag on the command-line. Additionally, you must remove any current tokens currently saved -in the [`credentials.toml` file] (which can be done with the new `logout` command). +in the [`credentials.toml` file] (which can be done with the [`cargo logout`] command). #### `credential-process` Configuration @@ -999,7 +997,7 @@ A basic authenticator is a process that returns a token on stdout. Newlines will be trimmed. The process inherits the user's stdin and stderr. It should exit 0 on success, and nonzero on error. -With this form, [`cargo login`] and `cargo logout` are not supported and +With this form, [`cargo login`] and [`cargo logout`] are not supported and return an error if used. ##### Cargo authenticator @@ -1044,28 +1042,8 @@ The following environment variables will be provided to the executed command: * `CARGO_REGISTRY_INDEX_URL` --- The URL of the registry index. * `CARGO_REGISTRY_NAME_OPT` --- Optional name of the registry. Should not be used as a storage key. Not always available. -#### `cargo logout` - -A new `cargo logout` command has been added to make it easier to remove a -token from storage. This supports both [`credentials.toml` file] tokens and -`credential-process` tokens. - -When used with `credentials.toml` file tokens, it needs the `-Z unstable-options` -command-line option: - -```console -cargo logout -Z unstable-options -``` - -When used with the `credential-process` config, use the `-Z -credential-process` command-line option: - - -```console -cargo logout -Z credential-process -``` - [`cargo login`]: ../commands/cargo-login.md +[`cargo logout`]: ../commands/cargo-logout.md [`cargo publish`]: ../commands/cargo-publish.md [`cargo owner`]: ../commands/cargo-owner.md [`cargo yank`]: ../commands/cargo-yank.md @@ -1488,4 +1466,8 @@ terminal where Cargo can automatically detect the width. Sparse registry support has been stabilized in the 1.68 release. See [Registry Protocols](registries.md#registry-protocols) for more information. +#### `cargo logout` + +The [`cargo logout`] command has been stabilized in the 1.70 release. + [target triple]: ../appendix/glossary.md#target '"target" (glossary)' diff --git a/src/etc/man/cargo-login.1 b/src/etc/man/cargo-login.1 index 79a9634db01..1ae1cc626ac 100644 --- a/src/etc/man/cargo-login.1 +++ b/src/etc/man/cargo-login.1 @@ -132,4 +132,4 @@ cargo login .RE .RE .SH "SEE ALSO" -\fBcargo\fR(1), \fBcargo\-publish\fR(1) +\fBcargo\fR(1), \fBcargo\-logout\fR(1), \fBcargo\-publish\fR(1) diff --git a/src/etc/man/cargo-logout.1 b/src/etc/man/cargo-logout.1 new file mode 100644 index 00000000000..7333cc62c0f --- /dev/null +++ b/src/etc/man/cargo-logout.1 @@ -0,0 +1,147 @@ +'\" t +.TH "CARGO\-LOGOUT" "1" +.nh +.ad l +.ss \n[.ss] 0 +.SH "NAME" +cargo\-logout \[em] Remove an API token from the registry locally +.SH "SYNOPSIS" +\fBcargo logout\fR [\fIoptions\fR] +.SH "DESCRIPTION" +This command will remove the API token from the local credential storage. +Credentials are stored in \fB$CARGO_HOME/credentials.toml\fR where \fB$CARGO_HOME\fR +defaults to \fB\&.cargo\fR in your home directory. +.sp +If \fB\-\-registry\fR is not specified, then the credentials for the default +registry will be removed (configured by +\fI\f(BIregistry.default\fI\fR , which defaults +to ). +.sp +This will not revoke the token on the server. If you need to revoke the token, +visit the registry website and follow its instructions (see + to revoke the token for ). +.SH "OPTIONS" +.SS "Logout Options" +.sp +\fB\-\-registry\fR \fIregistry\fR +.RS 4 +Name of the registry to use. Registry names are defined in \fICargo config +files\fR \&. If not specified, the default registry is used, +which is defined by the \fBregistry.default\fR config key which defaults to +\fBcrates\-io\fR\&. +.RE +.SS "Display Options" +.sp +\fB\-v\fR, +\fB\-\-verbose\fR +.RS 4 +Use verbose output. May be specified twice for \[lq]very verbose\[rq] output which +includes extra output such as dependency warnings and build script output. +May also be specified with the \fBterm.verbose\fR +\fIconfig value\fR \&. +.RE +.sp +\fB\-q\fR, +\fB\-\-quiet\fR +.RS 4 +Do not print cargo log messages. +May also be specified with the \fBterm.quiet\fR +\fIconfig value\fR \&. +.RE +.sp +\fB\-\-color\fR \fIwhen\fR +.RS 4 +Control when colored output is used. Valid values: +.sp +.RS 4 +\h'-04'\(bu\h'+02'\fBauto\fR (default): Automatically detect if color support is available on the +terminal. +.RE +.sp +.RS 4 +\h'-04'\(bu\h'+02'\fBalways\fR: Always display colors. +.RE +.sp +.RS 4 +\h'-04'\(bu\h'+02'\fBnever\fR: Never display colors. +.RE +.sp +May also be specified with the \fBterm.color\fR +\fIconfig value\fR \&. +.RE +.SS "Common Options" +.sp +\fB+\fR\fItoolchain\fR +.RS 4 +If Cargo has been installed with rustup, and the first argument to \fBcargo\fR +begins with \fB+\fR, it will be interpreted as a rustup toolchain name (such +as \fB+stable\fR or \fB+nightly\fR). +See the \fIrustup documentation\fR +for more information about how toolchain overrides work. +.RE +.sp +\fB\-\-config\fR \fIKEY=VALUE\fR or \fIPATH\fR +.RS 4 +Overrides a Cargo configuration value. The argument should be in TOML syntax of \fBKEY=VALUE\fR, +or provided as a path to an extra configuration file. This flag may be specified multiple times. +See the \fIcommand\-line overrides section\fR for more information. +.RE +.sp +\fB\-C\fR \fIPATH\fR +.RS 4 +Changes the current working directory before executing any specified operations. This affects +things like where cargo looks by default for the project manifest (\fBCargo.toml\fR), as well as +the directories searched for discovering \fB\&.cargo/config.toml\fR, for example. This option must +appear before the command name, for example \fBcargo \-C path/to/my\-project build\fR\&. +.sp +This option is only available on the \fInightly +channel\fR and +requires the \fB\-Z unstable\-options\fR flag to enable (see +\fI#10098\fR ). +.RE +.sp +\fB\-h\fR, +\fB\-\-help\fR +.RS 4 +Prints help information. +.RE +.sp +\fB\-Z\fR \fIflag\fR +.RS 4 +Unstable (nightly\-only) flags to Cargo. Run \fBcargo \-Z help\fR for details. +.RE +.SH "ENVIRONMENT" +See \fIthe reference\fR for +details on environment variables that Cargo reads. +.SH "EXIT STATUS" +.sp +.RS 4 +\h'-04'\(bu\h'+02'\fB0\fR: Cargo succeeded. +.RE +.sp +.RS 4 +\h'-04'\(bu\h'+02'\fB101\fR: Cargo failed to complete. +.RE +.SH "EXAMPLES" +.sp +.RS 4 +\h'-04' 1.\h'+01'Remove the default registry token: +.sp +.RS 4 +.nf +cargo logout +.fi +.RE +.RE +.sp +.RS 4 +\h'-04' 2.\h'+01'Remove the token for a specific registry: +.sp +.RS 4 +.nf +cargo logout \-\-registry my\-registry +.fi +.RE +.RE +.SH "SEE ALSO" +\fBcargo\fR(1), \fBcargo\-login\fR(1) diff --git a/src/etc/man/cargo.1 b/src/etc/man/cargo.1 index 374f25e4773..8f61e0699f2 100644 --- a/src/etc/man/cargo.1 +++ b/src/etc/man/cargo.1 @@ -120,6 +120,10 @@ available at \&. .br \ \ \ \ Save an API token from the registry locally. .sp +\fBcargo\-logout\fR(1) +.br +\ \ \ \ Remove an API token from the registry locally. +.sp \fBcargo\-owner\fR(1) .br \ \ \ \ Manage the owners of a crate on the registry. diff --git a/tests/testsuite/credential_process.rs b/tests/testsuite/credential_process.rs index ffcaa97e911..8c202c6a3ca 100644 --- a/tests/testsuite/credential_process.rs +++ b/tests/testsuite/credential_process.rs @@ -268,7 +268,7 @@ the credential-process configuration value must pass the \ cargo_process("logout -Z credential-process") .replace_crates_io(registry.index_url()) - .masquerade_as_nightly_cargo(&["credential-process", "cargo-logout"]) + .masquerade_as_nightly_cargo(&["credential-process"]) .with_status(101) .with_stderr( "\ @@ -377,7 +377,7 @@ fn logout() { .unwrap(); cargo_process("logout -Z credential-process") - .masquerade_as_nightly_cargo(&["credential-process", "cargo-logout"]) + .masquerade_as_nightly_cargo(&["credential-process"]) .replace_crates_io(server.index_url()) .with_stderr( "\ diff --git a/tests/testsuite/logout.rs b/tests/testsuite/logout.rs index 19f2cd9df56..7b5e10de2bf 100644 --- a/tests/testsuite/logout.rs +++ b/tests/testsuite/logout.rs @@ -5,31 +5,14 @@ use cargo_test_support::paths::{self, CargoPathExt}; use cargo_test_support::registry::TestRegistry; use cargo_test_support::{cargo_process, registry}; -#[cargo_test] -fn gated() { - registry::init(); - cargo_process("logout") - .masquerade_as_nightly_cargo(&["cargo-logout"]) - .with_status(101) - .with_stderr( - "\ -[ERROR] the `cargo logout` command is unstable, pass `-Z unstable-options` to enable it -See https://github.com/rust-lang/cargo/issues/8933 for more information about \ -the `cargo logout` command. -", - ) - .run(); -} - fn simple_logout_test(registry: &TestRegistry, reg: Option<&str>, flag: &str, note: &str) { let msg = reg.unwrap_or("crates-io"); check_token(Some(registry.token()), reg); - let mut cargo = cargo_process(&format!("logout -Z unstable-options {}", flag)); + let mut cargo = cargo_process(&format!("logout {}", flag)); if reg.is_none() { cargo.replace_crates_io(registry.index_url()); } cargo - .masquerade_as_nightly_cargo(&["cargo-logout"]) .with_stderr(&format!( "\ [LOGOUT] token for `{msg}` has been removed from local storage @@ -40,12 +23,11 @@ If you need to revoke the token, visit {note} and follow the instructions there. .run(); check_token(None, reg); - let mut cargo = cargo_process(&format!("logout -Z unstable-options {}", flag)); + let mut cargo = cargo_process(&format!("logout {}", flag)); if reg.is_none() { cargo.replace_crates_io(registry.index_url()); } cargo - .masquerade_as_nightly_cargo(&["cargo-logout"]) .with_stderr(&format!("[LOGOUT] not currently logged in to `{msg}`")) .run(); check_token(None, reg);