Skip to content

Commit 4b907f0

Browse files
committed
Stabilize cargo logout
1 parent 1b2de21 commit 4b907f0

File tree

20 files changed

+467
-58
lines changed

20 files changed

+467
-58
lines changed

src/bin/cargo/commands/logout.rs

Lines changed: 0 additions & 5 deletions
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
ops::registry_logout(
1914
config,
2015
args.get_one::<String>("registry").map(String::as_str),

src/doc/man/cargo-login.md

Lines changed: 1 addition & 1 deletion
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}}

src/doc/man/cargo-logout.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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 <https://crates.io/>
18+
will be removed.
19+
20+
This will not revoke the token on the server. If you need to revoke the token,
21+
visit the registry website and follow its instructions (see
22+
<https://crates.io/me> to revoke the token for <https://crates.io/>).
23+
24+
## OPTIONS
25+
26+
### Logout Options
27+
28+
{{#options}}
29+
{{> options-registry }}
30+
{{/options}}
31+
32+
### Display Options
33+
34+
{{#options}}
35+
{{> options-display }}
36+
{{/options}}
37+
38+
{{> section-options-common }}
39+
40+
{{> section-environment }}
41+
42+
{{> section-exit-status }}
43+
44+
## EXAMPLES
45+
46+
1. Remove the default registry token:
47+
48+
cargo logout
49+
50+
2. Remove the token for a specific registry:
51+
52+
cargo logout --registry my-registry
53+
54+
## SEE ALSO
55+
{{man "cargo" 1}}, {{man "cargo-login" 1}}

src/doc/man/cargo.md

Lines changed: 3 additions & 0 deletions
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

src/doc/man/generated_txt/cargo-login.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,5 +100,5 @@ EXAMPLES
100100
cargo login
101101

102102
SEE ALSO
103-
cargo(1), cargo-publish(1)
103+
cargo(1), cargo-logout(1), cargo-publish(1)
104104

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

src/doc/man/generated_txt/cargo.txt

Lines changed: 3 additions & 0 deletions
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

src/doc/src/SUMMARY.md

Lines changed: 1 addition & 0 deletions
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)

src/doc/src/commands/cargo-login.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,4 @@ details on environment variables that Cargo reads.
122122
cargo login
123123

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

0 commit comments

Comments
 (0)