简体   繁体   English

在Yeoman中,如何移动文件夹并在原始位置上强制删除?

[英]In Yeoman, how can I move a folder and force delete on the original location?

I am trying to move a folder in Yeoman without asking the user to approve every single file in the move. 我试图在Yeoman中移动文件夹,而不要求用户批准移动中的每个文件。 I currently have the two following ways to do this, but Yeoman's documentation is horrible and I can not figure out if there is a parameter to force delete. 我目前有以下两种方法可以执行此操作,但是Yeoman的文档非常糟糕,我无法弄清楚是否存在强制删除的参数。

//First way
this.fs.move(sourceDir, destDir);

//Second way
this.directory(sourceDir, destDir);
this.fs.delete(sourceDir);

Both of these ways will copy the folder + contents just fine, but the old folder remains or it will ask me to approve every removed file. 这两种方式都可以很好地复制文件夹+内容,但是旧文件夹仍然保留,或者它会要求我批准每个删除的文件。 I need it to just force delete somehow. 我需要它以某种方式强制删除。

Yeoman doesn't allow you to move pre-exisintg files around without asking user confirmation. Yeoman不允许您在未要求用户确认的情况下移动pre-exisintg文件。 User trusts Yeoman to not mess up their applications in unexpected way, so that's why it'll ask confirmation. 用户相信Yeoman不会以意想不到的方式弄乱他们的应用程序,因此这就是为什么它会要求确认的原因。

Users can always select accept all changes or run with yo generator --force to skip validation. 用户始终可以选择accept all更改或使用yo generator --force运行以跳过验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM