fn from_create_args(create_args: &CreateArgs) -> Result<Self, anyhow::Error> {
        Ok(TemplateArgs {
            copyright_year: Utc::now().year().to_string(),
            project_name: create_args.project_name.clone(),
            project_path: {
                let absolute_project_path = env::current_dir()?.join(&create_args.project_name);
                let fuchsia_root = util::get_fuchsia_root()?;
                absolute_project_path
                    .strip_prefix(&fuchsia_root)
                    .map_err(|_| {
                        anyhow!(
                            "current working directory must be a descendant of FUCHSIA_DIR ({:?})",
                            &fuchsia_root
                        )
                    })?
                    .to_str()
                    .ok_or_else(|| anyhow!("invalid path {:?}", &absolute_project_path))?
                    .to_string()
            },
            project_type: create_args.project_type.clone(),
        })
    }
/// Build TemplateArgs from the program args and environment.
Build TemplateArgs from the program args and environment.
Build TemplateArgs from the program args and environment .
fn from_create_args(create_args: &CreateArgs) -> Result<Self, anyhow::Error> {
        Ok(TemplateArgs {
            copyright_year: Utc::now().year().to_string(),
            project_name: create_args.project_name.clone(),
            project_path: {
                let absolute_project_path = env::current_dir()?.join(&create_args.project_name);
                let fuchsia_root = util::get_fuchsia_root()?;
                absolute_project_path
                    .strip_prefix(&fuchsia_root)
                    .map_err(|_| {
                        anyhow!(
                            "current working directory must be a descendant of FUCHSIA_DIR ({:?})",
                            &fuchsia_root
                        )
                    })?
                    .to_str()
                    .ok_or_else(|| anyhow!("invalid path {:?}", &absolute_project_path))?
                    .to_string()
            },
            project_type: create_args.project_type.clone(),
        })
    }
fn from_create_args ( create_args : & CreateArgs ) -> Result < Self , anyhow :: Error > { Ok ( TemplateArgs { copyright_year : Utc :: now ( ) . year ( ) . to_string ( ) , project_name : create_args . project_name . clone ( ) , project_path : { let absolute_project_path = env :: current_dir ( ) ? . join ( & create_args . project_name ) ; let fuchsia_root = util :: get_fuchsia_root ( ) ? ; absolute_project_path . strip_prefix ( & fuchsia_root ) . map_err ( | _ | { anyhow ! ( " " fuchsia_root ) } ) ? . to_str ( ) . ok_or_else ( | | anyhow ! ( " " absolute_project_path ) ) ? . to_string ( ) } , project_type : create_args . project_type . clone ( ) , } ) }
Build TemplateArgs from the program args and environment.
Build TemplateArgs from the program args and environment .
create_args
&CreateArgs
create_args
&CreateArgs