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: console-producer.rs
    path of file: ./repos/kafka-rust/examples
    
    the code of the file until where you have to start completion: use anyhow::{bail, ensure, Result};
use std::fs::File;
use std::io::{stderr, stdin, BufRead, BufReader, Write};
use std::ops::{Deref, DerefMut};
use std::str::FromStr;
use std::time::Duration;
use std::{env, process};

use anyhow::anyhow;

use
    
    fn from_cmdline() -> Result<Config> {
        let args: Vec<String> = env::args().collect();
        let mut opts = getopts::Options::new();
        opts.optflag("h", "help", "Print this help screen");
        opts.optopt(
            "",
            "brokers",
            "Specify kafka brokers (comma separated)",
            "HOSTS",
        );
        opts.optopt("", "topic", "Specify target topic", "NAME");
        opts.optopt("", "input", "Specify input file", "FILE");
        opts.optopt(
            "",
            "compression",
            "Compress messages [NONE, GZIP, SNAPPY]",
            "TYPE",
        );
        opts.optopt(
            "",
            "required-acks",
            "Specify amount of required broker acknowledgments [NONE, ONE, ALL]",
            "TYPE",
        );
        opts.optopt("", "ack-timeout", "Specify time to wait for acks", "MILLIS");
        opts.optopt("", "batch-size", "Send N message in one batch.", "N");
        opts.optopt(
            "",
            "idle-timeout",
            "Specify timeout for idle connections",
            "MILLIS",
        );

        macro_rules! on_error {
            ($name:expr) => {{
                let brief = format!("{} [options]", args[0]);
                println!("{}", opts.usage(&brief));
                bail!($name);
            }};
        }

        let m = match opts.parse(&args[1..]) {
            Ok(m) => m,
            Err(e) => on_error!(format!("Error {:?}", e)),
        };
        if m.opt_present("help") {
            on_error!("help")
        }
        Ok(Config {
            brokers: m
                .opt_str("brokers")
                .unwrap_or_else(|| "localhost:9092".to_owned())
                .split(',')
                .map(|s| s.trim().to_owned())
                .collect(),
            topic: m.opt_str("topic").unwrap_or_else(|| "my-topic".to_owned()),
            input_file: m.opt_str("input"),
            compression: match m.opt_str("compression") {
                None => Compression::NONE,
                Some(ref s) if s.eq_ignore_ascii_case("none") => Compression::NONE,
                #[cfg(feature = "gzip")]
                Some(ref s) if s.eq_ignore_ascii_case("gzip") => Compression::GZIP,
                #[cfg(feature = "snappy")]
                Some(ref s) if s.eq_ignore_ascii_case("snappy") => Compression::SNAPPY,
                Some(s) => {
                    return Err(anyhow!(
                        "Error {:?}",
                        format!("Unsupported compression type: {}", s)
                    ))
                }
            },
            required_acks: match m.opt_str("required-acks") {
                None => RequiredAcks::One,
                Some(ref s) if s.eq_ignore_ascii_case("none") => RequiredAcks::None,
                Some(ref s) if s.eq_ignore_ascii_case("one") => RequiredAcks::One,
                Some(ref s) if s.eq_ignore_ascii_case("all") => RequiredAcks::All,
                Some(s) => {
                    return Err(anyhow!(
                        "{:?}",
                        format!("Unknown --required-acks argument: {}", s)
                    ))
                }
            },
            batch_size: to_number(m.opt_str("batch-size"), 1)?,
            conn_idle_timeout: Duration::from_millis(to_number(
                m.opt_str("idle-timeout"),
                DEFAULT_CONNECTION_IDLE_TIMEOUT_MILLIS,
            )?),
            ack_timeout: Duration::from_millis(to_number(
                m.opt_str("ack-timeout"),
                DEFAULT_ACK_TIMEOUT_MILLIS,
            )?),
        })
    }