Skip to content

Commit 84b7041

Browse files
committed
Auto merge of #11950 - ehuss:stabilize-logout, r=epage
Stabilize `cargo logout` This stabilizes the `cargo logout` command. Closes #11910 Closes #11884
2 parents 3837689 + a70c108 commit 84b7041

20 files changed

+493
-58
lines changed

Diff for: src/bin/cargo/commands/logout.rs

-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ pub fn cli() -> Command {
1010
}
1111

1212
pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
13-
if !config.cli_unstable().credential_process {
14-
config
15-
.cli_unstable()
16-
.fail_if_stable_command(config, "logout", 8933)?;
17-
}
1813
let registry = args.registry(config)?;
1914
ops::registry_logout(config, registry.as_deref())?;
2015
Ok(())

Diff for: src/doc/man/cargo-login.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ Take care to keep the token secret, it should not be shared with anyone else.
4848
cargo login
4949

5050
## SEE ALSO
51-
{{man "cargo" 1}}, {{man "cargo-publish" 1}}
51+
{{man "cargo" 1}}, {{man "cargo-logout" 1}}, {{man "cargo-publish" 1}}

Diff for: src/doc/man/cargo-logout.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# cargo-logout(1)
2+
3+
## NAME
4+
5+
cargo-logout --- Remove an API token from the registry locally
6+
7+
## SYNOPSIS
8+
9+
`cargo logout` [_options_]
10+
11+
## DESCRIPTION
12+
13+
This command will remove the API token from the local credential storage.
14+
Credentials are stored in `$CARGO_HOME/credentials.toml` where `$CARGO_HOME`
15+
defaults to `.cargo` in your home directory.
16+
17+
If `--registry` is not specified, then the credentials for the default
18+
registry will be removed (configured by
19+
[`registry.default`](../reference/config.html#registrydefault), which defaults
20+
to <https://crates.io/>).
21+
22+
This will not revoke the token on the server. If you need to revoke the token,
23+
visit the registry website and follow its instructions (see
24+
<https://crates.io/me> to revoke the token for <https://crates.io/>).
25+
26+
## OPTIONS
27+
28+
### Logout Options
29+
30+
{{#options}}
31+
{{> options-registry }}
32+
{{/options}}
33+
34+
### Display Options
35+
36+
{{#options}}
37+
{{> options-display }}
38+
{{/options}}
39+
40+
{{> section-options-common }}
41+
42+
{{> section-environment }}
43+
44+
{{> section-exit-status }}
45+
46+
## EXAMPLES
47+
48+
1. Remove the default registry token:
49+
50+
cargo logout
51+
52+
2. Remove the token for a specific registry:
53+
54+
cargo logout --registry my-registry
55+
56+
## SEE ALSO
57+
{{man "cargo" 1}}, {{man "cargo-login" 1}}

Diff for: src/doc/man/cargo.md

+3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ available at <https://rust-lang.org>.
102102
{{man "cargo-login" 1}}\
103103
&nbsp;&nbsp;&nbsp;&nbsp;Save an API token from the registry locally.
104104

105+
{{man "cargo-logout" 1}}\
106+
&nbsp;&nbsp;&nbsp;&nbsp;Remove an API token from the registry locally.
107+
105108
{{man "cargo-owner" 1}}\
106109
&nbsp;&nbsp;&nbsp;&nbsp;Manage the owners of a crate on the registry.
107110

Diff for: src/doc/man/generated_txt/cargo-login.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,5 +107,5 @@ EXAMPLES
107107
cargo login
108108

109109
SEE ALSO
110-
cargo(1), cargo-publish(1)
110+
cargo(1), cargo-logout(1), cargo-publish(1)
111111

Diff for: src/doc/man/generated_txt/cargo-logout.txt

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
CARGO-LOGOUT(1)
2+
3+
NAME
4+
cargo-logout — Remove an API token from the registry locally
5+
6+
SYNOPSIS
7+
cargo logout [options]
8+
9+
DESCRIPTION
10+
This command will remove the API token from the local credential
11+
storage. Credentials are stored in $CARGO_HOME/credentials.toml where
12+
$CARGO_HOME defaults to .cargo in your home directory.
13+
14+
If --registry is not specified, then the credentials for the default
15+
registry will be removed (configured by registry.default
16+
<https://doc.rust-lang.org/cargo/reference/config.html#registrydefault>,
17+
which defaults to <https://crates.io/>).
18+
19+
This will not revoke the token on the server. If you need to revoke the
20+
token, visit the registry website and follow its instructions (see
21+
<https://crates.io/me> to revoke the token for <https://crates.io/>).
22+
23+
OPTIONS
24+
Logout Options
25+
--registry registry
26+
Name of the registry to use. Registry names are defined in Cargo
27+
config files
28+
<https://doc.rust-lang.org/cargo/reference/config.html>. If not
29+
specified, the default registry is used, which is defined by the
30+
registry.default config key which defaults to crates-io.
31+
32+
Display Options
33+
-v, --verbose
34+
Use verbose output. May be specified twice for “very verbose”
35+
output which includes extra output such as dependency warnings and
36+
build script output. May also be specified with the term.verbose
37+
config value
38+
<https://doc.rust-lang.org/cargo/reference/config.html>.
39+
40+
-q, --quiet
41+
Do not print cargo log messages. May also be specified with the
42+
term.quiet config value
43+
<https://doc.rust-lang.org/cargo/reference/config.html>.
44+
45+
--color when
46+
Control when colored output is used. Valid values:
47+
48+
o auto (default): Automatically detect if color support is
49+
available on the terminal.
50+
51+
o always: Always display colors.
52+
53+
o never: Never display colors.
54+
55+
May also be specified with the term.color config value
56+
<https://doc.rust-lang.org/cargo/reference/config.html>.
57+
58+
Common Options
59+
+toolchain
60+
If Cargo has been installed with rustup, and the first argument to
61+
cargo begins with +, it will be interpreted as a rustup toolchain
62+
name (such as +stable or +nightly). See the rustup documentation
63+
<https://rust-lang.github.io/rustup/overrides.html> for more
64+
information about how toolchain overrides work.
65+
66+
--config KEY=VALUE or PATH
67+
Overrides a Cargo configuration value. The argument should be in
68+
TOML syntax of KEY=VALUE, or provided as a path to an extra
69+
configuration file. This flag may be specified multiple times. See
70+
the command-line overrides section
71+
<https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides>
72+
for more information.
73+
74+
-C PATH
75+
Changes the current working directory before executing any specified
76+
operations. This affects things like where cargo looks by default
77+
for the project manifest (Cargo.toml), as well as the directories
78+
searched for discovering .cargo/config.toml, for example. This
79+
option must appear before the command name, for example cargo -C
80+
path/to/my-project build.
81+
82+
This option is only available on the nightly channel
83+
<https://doc.rust-lang.org/book/appendix-07-nightly-rust.html> and
84+
requires the -Z unstable-options flag to enable (see #10098
85+
<https://github.com/rust-lang/cargo/issues/10098>).
86+
87+
-h, --help
88+
Prints help information.
89+
90+
-Z flag
91+
Unstable (nightly-only) flags to Cargo. Run cargo -Z help for
92+
details.
93+
94+
ENVIRONMENT
95+
See the reference
96+
<https://doc.rust-lang.org/cargo/reference/environment-variables.html>
97+
for details on environment variables that Cargo reads.
98+
99+
EXIT STATUS
100+
o 0: Cargo succeeded.
101+
102+
o 101: Cargo failed to complete.
103+
104+
EXAMPLES
105+
1. Remove the default registry token:
106+
107+
cargo logout
108+
109+
2. Remove the token for a specific registry:
110+
111+
cargo logout --registry my-registry
112+
113+
SEE ALSO
114+
cargo(1), cargo-login(1)
115+

Diff for: src/doc/man/generated_txt/cargo.txt

+3
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ COMMANDS
9595
cargo-login(1)
9696
    Save an API token from the registry locally.
9797

98+
cargo-logout(1)
99+
    Remove an API token from the registry locally.
100+
98101
cargo-owner(1)
99102
    Manage the owners of a crate on the registry.
100103

Diff for: src/doc/src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
* [cargo uninstall](commands/cargo-uninstall.md)
8383
* [Publishing Commands](commands/publishing-commands.md)
8484
* [cargo login](commands/cargo-login.md)
85+
* [cargo logout](commands/cargo-logout.md)
8586
* [cargo owner](commands/cargo-owner.md)
8687
* [cargo package](commands/cargo-package.md)
8788
* [cargo publish](commands/cargo-publish.md)

Diff for: src/doc/src/commands/cargo-login.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,4 +127,4 @@ details on environment variables that Cargo reads.
127127
cargo login
128128

129129
## SEE ALSO
130-
[cargo(1)](cargo.html), [cargo-publish(1)](cargo-publish.html)
130+
[cargo(1)](cargo.html), [cargo-logout(1)](cargo-logout.html), [cargo-publish(1)](cargo-publish.html)

Diff for: src/doc/src/commands/cargo-logout.md

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# cargo-logout(1)
2+
3+
## NAME
4+
5+
cargo-logout --- Remove an API token from the registry locally
6+
7+
## SYNOPSIS
8+
9+
`cargo logout` [_options_]
10+
11+
## DESCRIPTION
12+
13+
This command will remove the API token from the local credential storage.
14+
Credentials are stored in `$CARGO_HOME/credentials.toml` where `$CARGO_HOME`
15+
defaults to `.cargo` in your home directory.
16+
17+
If `--registry` is not specified, then the credentials for the default
18+
registry will be removed (configured by
19+
[`registry.default`](../reference/config.html#registrydefault), which defaults
20+
to <https://crates.io/>).
21+
22+
This will not revoke the token on the server. If you need to revoke the token,
23+
visit the registry website and follow its instructions (see
24+
<https://crates.io/me> to revoke the token for <https://crates.io/>).
25+
26+
## OPTIONS
27+
28+
### Logout Options
29+
30+
<dl>
31+
<dt class="option-term" id="option-cargo-logout---registry"><a class="option-anchor" href="#option-cargo-logout---registry"></a><code>--registry</code> <em>registry</em></dt>
32+
<dd class="option-desc">Name of the registry to use. Registry names are defined in <a href="../reference/config.html">Cargo config
33+
files</a>. If not specified, the default registry is used,
34+
which is defined by the <code>registry.default</code> config key which defaults to
35+
<code>crates-io</code>.</dd>
36+
37+
38+
</dl>
39+
40+
### Display Options
41+
42+
<dl>
43+
<dt class="option-term" id="option-cargo-logout--v"><a class="option-anchor" href="#option-cargo-logout--v"></a><code>-v</code></dt>
44+
<dt class="option-term" id="option-cargo-logout---verbose"><a class="option-anchor" href="#option-cargo-logout---verbose"></a><code>--verbose</code></dt>
45+
<dd class="option-desc">Use verbose output. May be specified twice for “very verbose” output which
46+
includes extra output such as dependency warnings and build script output.
47+
May also be specified with the <code>term.verbose</code>
48+
<a href="../reference/config.html">config value</a>.</dd>
49+
50+
51+
<dt class="option-term" id="option-cargo-logout--q"><a class="option-anchor" href="#option-cargo-logout--q"></a><code>-q</code></dt>
52+
<dt class="option-term" id="option-cargo-logout---quiet"><a class="option-anchor" href="#option-cargo-logout---quiet"></a><code>--quiet</code></dt>
53+
<dd class="option-desc">Do not print cargo log messages.
54+
May also be specified with the <code>term.quiet</code>
55+
<a href="../reference/config.html">config value</a>.</dd>
56+
57+
58+
<dt class="option-term" id="option-cargo-logout---color"><a class="option-anchor" href="#option-cargo-logout---color"></a><code>--color</code> <em>when</em></dt>
59+
<dd class="option-desc">Control when colored output is used. Valid values:</p>
60+
<ul>
61+
<li><code>auto</code> (default): Automatically detect if color support is available on the
62+
terminal.</li>
63+
<li><code>always</code>: Always display colors.</li>
64+
<li><code>never</code>: Never display colors.</li>
65+
</ul>
66+
<p>May also be specified with the <code>term.color</code>
67+
<a href="../reference/config.html">config value</a>.</dd>
68+
69+
70+
</dl>
71+
72+
### Common Options
73+
74+
<dl>
75+
76+
<dt class="option-term" id="option-cargo-logout-+toolchain"><a class="option-anchor" href="#option-cargo-logout-+toolchain"></a><code>+</code><em>toolchain</em></dt>
77+
<dd class="option-desc">If Cargo has been installed with rustup, and the first argument to <code>cargo</code>
78+
begins with <code>+</code>, it will be interpreted as a rustup toolchain name (such
79+
as <code>+stable</code> or <code>+nightly</code>).
80+
See the <a href="https://rust-lang.github.io/rustup/overrides.html">rustup documentation</a>
81+
for more information about how toolchain overrides work.</dd>
82+
83+
84+
<dt class="option-term" id="option-cargo-logout---config"><a class="option-anchor" href="#option-cargo-logout---config"></a><code>--config</code> <em>KEY=VALUE</em> or <em>PATH</em></dt>
85+
<dd class="option-desc">Overrides a Cargo configuration value. The argument should be in TOML syntax of <code>KEY=VALUE</code>,
86+
or provided as a path to an extra configuration file. This flag may be specified multiple times.
87+
See the <a href="../reference/config.html#command-line-overrides">command-line overrides section</a> for more information.</dd>
88+
89+
90+
<dt class="option-term" id="option-cargo-logout--C"><a class="option-anchor" href="#option-cargo-logout--C"></a><code>-C</code> <em>PATH</em></dt>
91+
<dd class="option-desc">Changes the current working directory before executing any specified operations. This affects
92+
things like where cargo looks by default for the project manifest (<code>Cargo.toml</code>), as well as
93+
the directories searched for discovering <code>.cargo/config.toml</code>, for example. This option must
94+
appear before the command name, for example <code>cargo -C path/to/my-project build</code>.</p>
95+
<p>This option is only available on the <a href="https://doc.rust-lang.org/book/appendix-07-nightly-rust.html">nightly
96+
channel</a> and
97+
requires the <code>-Z unstable-options</code> flag to enable (see
98+
<a href="https://github.com/rust-lang/cargo/issues/10098">#10098</a>).</dd>
99+
100+
101+
<dt class="option-term" id="option-cargo-logout--h"><a class="option-anchor" href="#option-cargo-logout--h"></a><code>-h</code></dt>
102+
<dt class="option-term" id="option-cargo-logout---help"><a class="option-anchor" href="#option-cargo-logout---help"></a><code>--help</code></dt>
103+
<dd class="option-desc">Prints help information.</dd>
104+
105+
106+
<dt class="option-term" id="option-cargo-logout--Z"><a class="option-anchor" href="#option-cargo-logout--Z"></a><code>-Z</code> <em>flag</em></dt>
107+
<dd class="option-desc">Unstable (nightly-only) flags to Cargo. Run <code>cargo -Z help</code> for details.</dd>
108+
109+
110+
</dl>
111+
112+
113+
## ENVIRONMENT
114+
115+
See [the reference](../reference/environment-variables.html) for
116+
details on environment variables that Cargo reads.
117+
118+
119+
## EXIT STATUS
120+
121+
* `0`: Cargo succeeded.
122+
* `101`: Cargo failed to complete.
123+
124+
125+
## EXAMPLES
126+
127+
1. Remove the default registry token:
128+
129+
cargo logout
130+
131+
2. Remove the token for a specific registry:
132+
133+
cargo logout --registry my-registry
134+
135+
## SEE ALSO
136+
[cargo(1)](cargo.html), [cargo-login(1)](cargo-login.html)

Diff for: src/doc/src/commands/cargo.md

+3
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ available at <https://rust-lang.org>.
102102
[cargo-login(1)](cargo-login.html)\
103103
&nbsp;&nbsp;&nbsp;&nbsp;Save an API token from the registry locally.
104104

105+
[cargo-logout(1)](cargo-logout.html)\
106+
&nbsp;&nbsp;&nbsp;&nbsp;Remove an API token from the registry locally.
107+
105108
[cargo-owner(1)](cargo-owner.html)\
106109
&nbsp;&nbsp;&nbsp;&nbsp;Manage the owners of a crate on the registry.
107110

Diff for: src/doc/src/commands/publishing-commands.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Publishing Commands
22
* [cargo login](cargo-login.md)
3+
* [cargo logout](cargo-logout.md)
34
* [cargo owner](cargo-owner.md)
45
* [cargo package](cargo-package.md)
56
* [cargo publish](cargo-publish.md)

0 commit comments

Comments
 (0)