Skip to content

Commit c3dcfd8

Browse files
committed
Auto merge of #9680 - inquisitivecrystal:doc-alias, r=ehuss
Add `d` as an alias for `doc` I expected that this alias would already exist. `doc` feels to me like the other commands that currently have aliases. `build`, `check`, `run`, and `test` are all modes of using the existing repository, and are all things one might run at least somewhat frequently during development. There is no other built in cargo subcommand that starts with `d`, so this also has the virtue of being pretty unambiguous.
2 parents ae51ab9 + b2e5d8a commit c3dcfd8

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

src/bin/cargo/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ Some common cargo commands are (see all commands with --list):
319319
build, b Compile the current package
320320
check, c Analyze the current package and report errors, but don't build object files
321321
clean Remove the target directory
322-
doc Build this package's and its dependencies' documentation
322+
doc, d Build this package's and its dependencies' documentation
323323
new Create a new cargo package
324324
init Create a new cargo package in an existing directory
325325
run, r Run a binary or example of the local package

src/bin/cargo/commands/doc.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ use cargo::ops::{self, DocOptions};
44

55
pub fn cli() -> App {
66
subcommand("doc")
7+
// subcommand aliases are handled in aliased_command()
8+
// .alias("d")
79
.about("Build a package's documentation")
810
.arg(opt("quiet", "No output printed to stdout").short("q"))
911
.arg(opt(

src/bin/cargo/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ fn main() {
4848

4949
/// Table for defining the aliases which come builtin in `Cargo`.
5050
/// The contents are structured as: `(alias, aliased_command, description)`.
51-
const BUILTIN_ALIASES: [(&str, &str, &str); 4] = [
51+
const BUILTIN_ALIASES: [(&str, &str, &str); 5] = [
5252
("b", "build", "alias: build"),
5353
("c", "check", "alias: check"),
54+
("d", "doc", "alias: doc"),
5455
("r", "run", "alias: run"),
5556
("t", "test", "alias: test"),
5657
];

src/doc/src/reference/config.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ subcommand and arguments. The following aliases are built-in to Cargo:
260260
[alias]
261261
b = "build"
262262
c = "check"
263+
d = "doc"
263264
t = "test"
264265
r = "run"
265266
```

0 commit comments

Comments
 (0)