fn execute(flags: Flags, config: &Config) -> CliResult<Option<()>> {
    try!(config.shell().set_verbosity(flags.flag_verbose, flags.flag_quiet));
    try!(config.shell().set_color_config(flags.flag_color.as_ref().map(|s| &s[..])));

    init_git_transports(config);

    if flags.flag_list {
        println!("Installed Commands:");
        for command in list_commands(config) {
            println!("    {}", command);
        };
        return Ok(None)
    }

    let args = match &flags.arg_command[..] {
        // For the commands `cargo` and `cargo help`, re-execute ourselves as
        // `cargo -h` so we can go through the normal process of printing the
        // help message.
        "" | "help" if flags.arg_args.is_empty() => {
            config.shell().set_verbose(true);
            let args = &["cargo".to_string(), "-h".to_string()];
            let r = cargo::call_main_without_stdin(execute, config, USAGE, args,
                                                   false);
            cargo::process_executed(r, &mut config.shell());
            return Ok(None)
        }

        // For `cargo help -h` and `cargo help --help`, print out the help
        // message for `cargo help`
        "help" if flags.arg_args[0] == "-h" ||
                  flags.arg_args[0] == "--help" => {
            vec!["cargo".to_string(), "help".to_string(), "-h".to_string()]
        }

        // For `cargo help foo`, print out the usage message for the specified
        // subcommand by executing the command with the `-h` flag.
        "help" => vec!["cargo".to_string(), flags.arg_args[0].clone(),
                       "-h".to_string()],

        // For all other invocations, we're of the form `cargo foo args...`. We
        // use the exact environment arguments to preserve tokens like `--` for
        // example.
        _ => env::args().collect(),
    };

    macro_rules! cmd{
        ($name:ident) => (if args[1] == stringify!($name).replace("_", "-") {
            mod $name;
            config.shell().set_verbose(true);
            let r = cargo::call_main_without_stdin($name::execute, config,
                                                   $name::USAGE,
                                                   &args,
                                                   false);
            cargo::process_executed(r, &mut config.shell());
            return Ok(None)
        })
    }
    each_subcommand!(cmd);

    try!(execute_subcommand(config, &args[1], &args));
    Ok(None)
}
/**
  The top-level `cargo` command handles configuration and project location
  because they are fundamental (and intertwined). Other commands can rely
  on this top-level information.
*/
The top-level `cargo` command handles configuration and project location
because they are fundamental (and intertwined). Other commands can rely
on this top-level information.
The top - level ` cargo ` command handles configuration and project location because they are fundamental ( and intertwined ) . Other commands can rely on this top - level information .
fn execute(flags: Flags, config: &Config) -> CliResult<Option<()>> {
    try!(config.shell().set_verbosity(flags.flag_verbose, flags.flag_quiet));
    try!(config.shell().set_color_config(flags.flag_color.as_ref().map(|s| &s[..])));
    init_git_transports(config);
    if flags.flag_list {
        println!("Installed Commands:");
        for command in list_commands(config) {
            println!("    {}", command);
        };
        return Ok(None)
    }
    let args = match &flags.arg_command[..] {
        // For the commands `cargo` and `cargo help`, re-execute ourselves as
        // `cargo -h` so we can go through the normal process of printing the
        // help message.
        "" | "help" if flags.arg_args.is_empty() => {
            config.shell().set_verbose(true);
            let args = &["cargo".to_string(), "-h".to_string()];
            let r = cargo::call_main_without_stdin(execute, config, USAGE, args,
                                                   false);
            cargo::process_executed(r, &mut config.shell());
            return Ok(None)
        }
        // For `cargo help -h` and `cargo help --help`, print out the help
        // message for `cargo help`
        "help" if flags.arg_args[0] == "-h" ||
                  flags.arg_args[0] == "--help" => {
            vec!["cargo".to_string(), "help".to_string(), "-h".to_string()]
        }
        // For `cargo help foo`, print out the usage message for the specified
        // subcommand by executing the command with the `-h` flag.
        "help" => vec!["cargo".to_string(), flags.arg_args[0].clone(),
                       "-h".to_string()],
        // For all other invocations, we're of the form `cargo foo args...`. We
        // use the exact environment arguments to preserve tokens like `--` for
        // example.
        _ => env::args().collect(),
    };
    macro_rules! cmd{
        ($name:ident) => (if args[1] == stringify!($name).replace("_", "-") {
            mod $name;
            config.shell().set_verbose(true);
            let r = cargo::call_main_without_stdin($name::execute, config,
                                                   $name::USAGE,
                                                   &args,
                                                   false);
            cargo::process_executed(r, &mut config.shell());
            return Ok(None)
        })
    }
    each_subcommand!(cmd);
    try!(execute_subcommand(config, &args[1], &args));
    Ok(None)
}
fn execute ( flags : Flags , config : & Config ) -> CliResult < Option < ( ) > > { try ! ( config shell ( ) set_verbosity ( flags flag_verbose flags flag_quiet ) ) ; try ! ( config shell ( ) set_color_config ( flags flag_color as_ref ( ) map ( s s [ ] ) ) ) ; init_git_transports ( config ) ; if flags . flag_list { println ! ( " " ) ; for command in list_commands ( config ) { println ! ( " " command ) ; } ; return Ok ( None ) } let args = match & flags . arg_command [ .. ] { // For the commands `cargo` and `cargo help`, re-execute ourselves as // `cargo -h` so we can go through the normal process of printing the // help message. " " | " " if flags . arg_args . is_empty ( ) => { config . shell ( ) . set_verbose ( true ) ; let args = & [ " " . to_string ( ) , " " . to_string ( ) ] ; let r = cargo :: call_main_without_stdin ( execute , config , USAGE , args , false ) ; cargo :: process_executed ( r , & mut config . shell ( ) ) ; return Ok ( None ) } // For `cargo help -h` and `cargo help --help`, print out the help // message for `cargo help` " " if flags . arg_args [ 0 ] == " " || flags . arg_args [ 0 ] == " " => { vec ! [ " " to_string ( ) " " to_string ( ) " " to_string ( ) ] } // For `cargo help foo`, print out the usage message for the specified // subcommand by executing the command with the `-h` flag. " " => vec ! [ " " to_string ( ) flags arg_args [ 0 ] clone ( ) " " to_string ( ) ] , // For all other invocations, we're of the form `cargo foo args...`. We // use the exact environment arguments to preserve tokens like `--` for // example. _ => env :: args ( ) . collect ( ) , } ; macro_rules! cmd { ( $name : ident ) => ( if args [ 1 ] stringify ( $name ) replace ( " " " " ) { mod $name config shell ( ) set_verbose ( true ) let r cargo call_main_without_stdin ( $name execute config $name USAGE args false ) cargo process_executed ( r mut config shell ( ) ) return Ok ( None ) } ) } each_subcommand ! ( cmd ) ; try ! ( execute_subcommand ( config args [ 1 ] args ) ) ; Ok ( None ) }
The top-level `cargo` command handles configuration and project location
because they are fundamental (and intertwined).
The top - level ` cargo ` command handles configuration and project location because they are fundamental ( and intertwined ) .
flags
Flags
config
&Config
flags
Flags
config
&Config