Skip to content

Commit c80998b

Browse files
author
梶塚太智
committed
Update main.rs
コマンド`rename`を実装
1 parent 5c386e6 commit c80998b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/main.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,13 @@ impl Executor {
921921
}
922922
}
923923

924+
// アイテム名を変更
925+
"rename" => {
926+
let to = self.pop_stack().get_string();
927+
let from = self.pop_stack().get_string();
928+
let _result = fs::rename(from, to);
929+
}
930+
924931
// ファイル一覧のリスト
925932
"ls" => {
926933
if let Ok(entries) = fs::read_dir(".") {

0 commit comments

Comments
 (0)