From 13e2669c0d992fba5446681fdc2f6c6ff91393e1 Mon Sep 17 00:00:00 2001 From: stom698 Date: Wed, 18 Dec 2024 10:02:02 +0800 Subject: [PATCH] Add a default .move file creation feature to the rooch move new command (#3056) --- .../move/language/tools/move-cli/src/base/new.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/third_party/move/language/tools/move-cli/src/base/new.rs b/third_party/move/language/tools/move-cli/src/base/new.rs index 838e3d629c..39dbd4b216 100644 --- a/third_party/move/language/tools/move-cli/src/base/new.rs +++ b/third_party/move/language/tools/move-cli/src/base/new.rs @@ -57,6 +57,19 @@ impl New { None => Path::new(&name), }; create_dir_all(path.join(SourcePackageLayout::Sources.path()))?; + let mut source_file = std::fs::File::create( + path.join(SourcePackageLayout::Sources.path()) + .join(format!("{name}.move")), + )?; + writeln!( + &mut source_file, + r#"/* +/// Module: {name} +module {name}::{name} {{ +}} +*/"#, + name = name + )?; let mut w = std::fs::File::create(path.join(SourcePackageLayout::Manifest.path()))?; writeln!( &mut w,