Skip to content

Commit

Permalink
fix(iota-move, move-cli): fix <NAME> uppercase issue, update validati…
Browse files Browse the repository at this point in the history
…on error message (#4916)
  • Loading branch information
roman1e2f5p8s authored Jan 31, 2025
1 parent 576e9d9 commit a2a18ac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion crates/iota-move/src/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ pub struct New {
impl New {
pub fn execute(self, path: Option<&Path>) -> anyhow::Result<()> {
let name = &self.new.name.to_lowercase();
let provided_name = &self.new.name.to_string();

self.new
.execute(path, [(IOTA_PKG_NAME, IOTA_PKG_PATH)], [(name, "0x0")], "")?;
let p = path.unwrap_or_else(|| Path::new(&name));
let p = path.unwrap_or_else(|| Path::new(&provided_name));
let mut w = std::fs::File::create(
p.join(SourcePackageLayout::Sources.path())
.join(format!("{name}.move")),
Expand Down
4 changes: 2 additions & 2 deletions external-crates/move/crates/move-cli/src/base/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ impl New {

if !Identifier::is_valid(&name) {
return Err(anyhow!(
"Invalid package name. Package name must start with a lowercase letter \
and consist only of lowercase letters, numbers, and underscores."
"Invalid package name. Package name must start with a letter or underscore \
and consist only of letters, numbers, and underscores."
));
}

Expand Down

0 comments on commit a2a18ac

Please sign in to comment.