Skip to content

Commit 3a32d3b

Browse files
committed
doc: rustdoc for aliased_command
1 parent f17d230 commit 3a32d3b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/bin/cargo/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ fn builtin_aliases_execs(cmd: &str) -> Option<&(&str, &str, &str)> {
5252
BUILTIN_ALIASES.iter().find(|alias| alias.0 == cmd)
5353
}
5454

55+
/// Resolve the aliased command from the [`Config`] with a given command string.
56+
///
57+
/// The search fallback chain is:
58+
///
59+
/// 1. Get the aliased command as a string.
60+
/// 2. If an `Err` occurs (missing key, type mismatch, or any possible error),
61+
/// try to get it as an array again.
62+
/// 3. If still cannot find any, finds one insides [`BUILTIN_ALIASES`].
5563
fn aliased_command(config: &Config, command: &str) -> CargoResult<Option<Vec<String>>> {
5664
let alias_name = format!("alias.{}", command);
5765
let user_alias = match config.get_string(&alias_name) {

0 commit comments

Comments
 (0)