pub fn add_cidr(cidrs: &[Cidr]) -> Result<Option<CidrContents>, Error> {
    let parent_cidr = choose_cidr(cidrs, "Parent CIDR")?;
    let name: String = Input::with_theme(&*THEME).with_prompt("Name").interact()?;
    let cidr: IpNetwork = Input::with_theme(&*THEME).with_prompt("CIDR").interact()?;

    let cidr_request = CidrContents {
        name,
        cidr,
        parent: Some(parent_cidr.id),
    };

    Ok(
        if Confirm::with_theme(&*THEME)
            .with_prompt(&format!("Create CIDR \"{}\"?", cidr_request.name))
            .default(false)
            .interact()?
        {
            Some(cidr_request)
        } else {
            None
        },
    )
}
/// Bring up a prompt to create a new CIDR. Returns the peer request.
Bring up a prompt to create a new CIDR. Returns the peer request.
Bring up a prompt to create a new CIDR . Returns the peer request .
pub fn add_cidr(cidrs: &[Cidr]) -> Result<Option<CidrContents>, Error> {
    let parent_cidr = choose_cidr(cidrs, "Parent CIDR")?;
    let name: String = Input::with_theme(&*THEME).with_prompt("Name").interact()?;
    let cidr: IpNetwork = Input::with_theme(&*THEME).with_prompt("CIDR").interact()?;
    let cidr_request = CidrContents {
        name,
        cidr,
        parent: Some(parent_cidr.id),
    };
    Ok(
        if Confirm::with_theme(&*THEME)
            .with_prompt(&format!("Create CIDR \"{}\"?", cidr_request.name))
            .default(false)
            .interact()?
        {
            Some(cidr_request)
        } else {
            None
        },
    )
}
pub fn add_cidr ( cidrs : & [ Cidr ] ) -> Result < Option < CidrContents > , Error > { let parent_cidr = choose_cidr ( cidrs , " " ) ? ; let name : String = Input :: with_theme ( & * THEME ) . with_prompt ( " " ) . interact ( ) ? ; let cidr : IpNetwork = Input :: with_theme ( & * THEME ) . with_prompt ( " " ) . interact ( ) ? ; let cidr_request = CidrContents { name , cidr , parent : Some ( parent_cidr . id ) , } ; Ok ( if Confirm :: with_theme ( & * THEME ) . with_prompt ( & format ! ( " \" \" " cidr_request name ) ) . default ( false ) . interact ( ) ? { Some ( cidr_request ) } else { None } , ) }
Bring up a prompt to create a new CIDR.
Bring up a prompt to create a new CIDR .
cidrs
&[Cidr]
cidrs
&[Cidr]