Skip to main content

multiversx_sc_meta/cmd/template/
contract_creator_target.rs

1use std::path::PathBuf;
2
3use convert_case::{Case, Casing};
4
5#[derive(Clone)]
6pub struct ContractCreatorTarget {
7    pub target_path: PathBuf,
8    pub new_name: String,
9}
10
11impl ContractCreatorTarget {
12    /// Will convert new_name to kebab-case.
13    pub fn new(contract_dir: PathBuf, new_name: &str) -> Self {
14        Self {
15            target_path: contract_dir,
16            new_name: new_name.to_case(Case::Kebab),
17        }
18    }
19
20    pub fn contract_dir(&self) -> PathBuf {
21        self.target_path.join(&self.new_name)
22    }
23}