Cargo is a single binary composed of a set of clap subcommands. All subcommands live in src/bin/cargo/commands directory. src/bin/cargo/main.rs is the entry point.
Each subcommand, such as src/bin/cargo/commands/build.rs, usually performs the following:
command_prelude module for some helpers to make this easier.src/ops.If the subcommand is not found in the built-in list, then Cargo will automatically search for a subcommand named cargo-{NAME} in the users PATH to execute the subcommand.