SubCommands
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:
- Parse the CLI flags. See the
command_preludemodule for some helpers to make this easier. - Load the config files.
- Discover and load the workspace.
- Calls the actual implementation of the subcommand which resides in
src/cargo/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.