You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: main.rs
    path of file: ./repos/chiselstrike/cli/src
    
    the code of the file until where you have to start completion: // SPDX-FileCopyrightText: Â© 2021 ChiselStrike <info@chiselstrike.com>

use crate::cmd::apply::apply;
use crate::cmd::dev::cmd_dev;
use crate::cmd::generate;
use crate::project::{create_project, CreateProjectOptions};
use crate::proto::chisel_rpc_client::ChiselRpcClient;
use crate::proto::{
    type_msg::TypeEnum, DeleteRequest, DescribeRequest, PopulateRequest, StatusRequest,
};
use crate::server::{start_server, wait
    
async fn main() -> Result<()> {
    let chisel_args = std::env::args().take_while(|arg| arg != "--");
    let mut chiseld_args = std::env::args()
        .skip_while(|arg| arg != "--")
        .skip(1)
        .collect::<Vec<_>>();

    let opt = Opt::parse_from(chisel_args);
    let server_url = opt.rpc_addr;
    let api_listen_addr = opt.api_listen_addr;
    match opt.cmd {
        Command::Init {
            force,
            no_examples,
            optimize,
            auto_index,
        } => {
            let cwd = env::current_dir()?;
            let opts = CreateProjectOptions {
                force,
                examples: !no_examples,
                optimize,
                auto_index,
            };
            create_project(&cwd, opts)?;
        }
        Command::Describe => {
            let mut client = ChiselRpcClient::connect(server_url).await?;
            let request = tonic::Request::new(DescribeRequest {});
            let response = execute!(client.describe(request).await);

            for version_def in response.version_defs {
                println!("Version: {} {{", version_def.version_id);
                for def in &version_def.type_defs {
                    println!("  class {} {{", def.name);
                    for field in &def.field_defs {
                        let labels = if field.labels.is_empty() {
                            "".into()
                        } else {
                            let mut labels = field
                                .labels
                                .iter()
                                .map(|x| format!("\"{}\", ", x))
                                .collect::<String>();
                            // We add a , and a space in the map() function above to each element,
                            // so for the last element we pop them both.
                            labels.pop();
                            labels.pop();
                            format!("@labels({}) ", labels)
                        };
                        let field_type = field.field_type()?;
                        println!(
                            "    {}{}{}{}: {}{};",
                            if field.is_unique { "@unique " } else { "" },
                            labels,
                            field.name,
                            if field.is_optional { "?" } else { "" },
                            field_type,
                            field
                                .default_value
                                .as_ref()
                                .map(|d| if matches!(field_type, TypeEnum::String(_)) {
                                    format!(" = \"{}\"", d)
                                } else {
                                    format!(" = {}", d)
                                })
                                .unwrap_or_else(|| "".into()),
                        );
                    }
                    println!("  }}");
                }
                for def in &version_def.label_policy_defs {
                    println!("  Label policy: {}", def.label);
                }
                println!("}}");
            }
        }
        Command::Dev {
            type_check,
            inspect,
        } => {
            let fut = cmd_dev(server_url.clone(), type_check);
            let cb = |mut server: Child, res| async move {
                let sig_task = res?;
                server.kill().await?;
                server.wait().await?;
                sig_task.await??;

                Ok(())
            };
            chiseld_args.push("--debug".to_string());
            if inspect {
                chiseld_args.push("--inspect".to_string());
            }
            spawn_server(chiseld_args, fut, cb).await?;
        }
        Command::Generate {
            output_dir,
            version,
            mode,
        } => {
            let args = generate::Opts {
                server_url,
                api_addr: api_listen_addr,
                output_dir,
                version,
                mode,
            };
            generate::cmd_generate(args).await?;
        }
        Command::New {
            path,
            no_examples,
            optimize,
            auto_index,
        } => {
            let path = Path::new(&path);
            if let Err(e) = fs::create_dir(path) {
                match e.kind() {
                    ErrorKind::AlreadyExists => {
                        anyhow::bail!("Directory `{}` already exists. Use `chisel init` to initialize a project in the directory.", path.display());
                    }
                    _ => {
                        anyhow::bail!(
                            "Unable to create a ChiselStrike project in `{}`: {}",
                            path.display(),
                            e
                        );
                    }
                }
            }
            let opts = CreateProjectOptions {
                force: false,
                examples: !no_examples,
                optimize,
                auto_index,
            };
            create_project(path, opts)?;
        }
        Command::Start => {
            let fut = wait(server_url);
            let cb = |mut server: Child, res: Result<_>| async move {
                res?;
                server.wait().await?;

                Ok(())
            };

            spawn_server(chiseld_args, fut, cb).await?;
        }
        Command::Status => {
            let mut client = ChiselRpcClient::connect(server_url).await?;
            let request = tonic::Request::new(StatusRequest {});
            let response = execute!(client.get_status(request).await);
            println!("Server status is {}", response.message);
        }
        Command::Wait => {
            wait(server_url).await?;
        }
        Command::Apply {
            allow_type_deletion,
            version,
            type_check,
        } => {
            apply(
                server_url,
                version,
                allow_type_deletion.into(),
                type_check.into(),
            )
            .await?;
        }
        Command::Delete { version } => {
            delete(server_url, version).await?;
        }
        Command::Populate { version, from } => {
            populate(server_url, version, from).await?;
        }
    }

    Ok(())
}