fn generate_licenses(&self) -> Result<()> {
        if self.licenses.len() > 1 {
            std::fs::create_dir("docs").context("`docs` directory already exists")?;

            let formatted_file =
                self.create_license(&format!("{}{}", &self.licenses.join("_"), "_license"))?;

            let mut output = create_file("LICENSE")?;

            output.write_all(formatted_file.as_bytes())?;

            for license in &self.licenses {
                match license.as_str() {
                    "mit" => {
                        let formatted_file = self.create_license("mit")?;
                        let mut output = create_file("docs/LICENSE-MIT")?;

                        output.write_all(formatted_file.as_bytes())?;
                    }
                    "apache" => {
                        let formatted_file = self.create_license("apache")?;
                        let mut output = create_file("docs/LICENSE-APACHE")?;

                        output.write_all(formatted_file.as_bytes())?;
                    }
                    _ => {
                        println!("Unsupported license: {}", license);
                    }
                }
            }
        } else {
            let formatted_file = self.create_license(&self.licenses[0])?;
            let mut output = create_file("LICENSE")?;

            output.write_all(formatted_file.as_bytes())?;
        }

        Ok(())
    }
/// Generates all of the specified license files for the project.
Generates all of the specified license files for the project.
Generates all of the specified license files for the project .
fn generate_licenses(&self) -> Result<()> {
        if self.licenses.len() > 1 {
            std::fs::create_dir("docs").context("`docs` directory already exists")?;
            let formatted_file =
                self.create_license(&format!("{}{}", &self.licenses.join("_"), "_license"))?;
            let mut output = create_file("LICENSE")?;
            output.write_all(formatted_file.as_bytes())?;
            for license in &self.licenses {
                match license.as_str() {
                    "mit" => {
                        let formatted_file = self.create_license("mit")?;
                        let mut output = create_file("docs/LICENSE-MIT")?;
                        output.write_all(formatted_file.as_bytes())?;
                    }
                    "apache" => {
                        let formatted_file = self.create_license("apache")?;
                        let mut output = create_file("docs/LICENSE-APACHE")?;
                        output.write_all(formatted_file.as_bytes())?;
                    }
                    _ => {
                        println!("Unsupported license: {}", license);
                    }
                }
            }
        } else {
            let formatted_file = self.create_license(&self.licenses[0])?;
            let mut output = create_file("LICENSE")?;
            output.write_all(formatted_file.as_bytes())?;
        }
        Ok(())
    }
fn generate_licenses ( & self ) -> Result < ( ) > { if self . licenses . len ( ) > 1 { std :: fs :: create_dir ( " " ) . context ( " " ) ? ; let formatted_file = self . create_license ( & format ! ( " " self licenses join ( " " ) " " ) ) ? ; let mut output = create_file ( " " ) ? ; output . write_all ( formatted_file . as_bytes ( ) ) ? ; for license in & self . licenses { match license . as_str ( ) { " " => { let formatted_file = self . create_license ( " " ) ? ; let mut output = create_file ( " " ) ? ; output . write_all ( formatted_file . as_bytes ( ) ) ? ; } " " => { let formatted_file = self . create_license ( " " ) ? ; let mut output = create_file ( " " ) ? ; output . write_all ( formatted_file . as_bytes ( ) ) ? ; } _ => { println ! ( " " license ) ; } } } } else { let formatted_file = self . create_license ( & self . licenses [ 0 ] ) ? ; let mut output = create_file ( " " ) ? ; output . write_all ( formatted_file . as_bytes ( ) ) ? ; } Ok ( ( ) ) }
Generates all of the specified license files for the project.
Generates all of the specified license files for the project .
&self
&self