From 82636e86676a8902f0396c722f71c394e4bac20c Mon Sep 17 00:00:00 2001 From: inquisitivecrystal <22333129+inquisitivecrystal@users.noreply.github.com> Date: Sun, 11 Jul 2021 14:43:36 -0700 Subject: [PATCH 1/2] Add `d` as an alias for `doc` --- src/bin/cargo/cli.rs | 2 +- src/bin/cargo/commands/doc.rs | 2 ++ src/bin/cargo/main.rs | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bin/cargo/cli.rs b/src/bin/cargo/cli.rs index e3a62cd161a..1fa8c9b9c7a 100644 --- a/src/bin/cargo/cli.rs +++ b/src/bin/cargo/cli.rs @@ -319,7 +319,7 @@ Some common cargo commands are (see all commands with --list): build, b Compile the current package check, c Analyze the current package and report errors, but don't build object files clean Remove the target directory - doc Build this package's and its dependencies' documentation + doc, d Build this package's and its dependencies' documentation new Create a new cargo package init Create a new cargo package in an existing directory run, r Run a binary or example of the local package diff --git a/src/bin/cargo/commands/doc.rs b/src/bin/cargo/commands/doc.rs index 7ef405177be..cabb51b3828 100644 --- a/src/bin/cargo/commands/doc.rs +++ b/src/bin/cargo/commands/doc.rs @@ -4,6 +4,8 @@ use cargo::ops::{self, DocOptions}; pub fn cli() -> App { subcommand("doc") + // subcommand aliases are handled in aliased_command() + // .alias("d") .about("Build a package's documentation") .arg(opt("quiet", "No output printed to stdout").short("q")) .arg(opt( diff --git a/src/bin/cargo/main.rs b/src/bin/cargo/main.rs index 0ca7d6e298e..6f9134b8c54 100644 --- a/src/bin/cargo/main.rs +++ b/src/bin/cargo/main.rs @@ -48,9 +48,10 @@ fn main() { /// Table for defining the aliases which come builtin in `Cargo`. /// The contents are structured as: `(alias, aliased_command, description)`. -const BUILTIN_ALIASES: [(&str, &str, &str); 4] = [ +const BUILTIN_ALIASES: [(&str, &str, &str); 5] = [ ("b", "build", "alias: build"), ("c", "check", "alias: check"), + ("d", "doc", "alias: doc"), ("r", "run", "alias: run"), ("t", "test", "alias: test"), ]; From b2e5d8a4549d209e25f31432f2c22cba9db77ec9 Mon Sep 17 00:00:00 2001 From: inquisitivecrystal <22333129+inquisitivecrystal@users.noreply.github.com> Date: Thu, 15 Jul 2021 15:31:39 -0700 Subject: [PATCH 2/2] Document `d` alias --- src/doc/src/reference/config.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/doc/src/reference/config.md b/src/doc/src/reference/config.md index a6fc0b0f1ff..4330fb20894 100644 --- a/src/doc/src/reference/config.md +++ b/src/doc/src/reference/config.md @@ -252,6 +252,7 @@ subcommand and arguments. The following aliases are built-in to Cargo: [alias] b = "build" c = "check" +d = "doc" t = "test" r = "run" ```