Skip to content

Commit cb78721

Browse files
author
梶塚太智
committed
Update main.rs
1 parent 03a925e commit cb78721

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/main.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ impl Executor {
872872
//カレントディレクトリを変更
873873
"cd" => {
874874
if let Err(err) = std::env::set_current_dir(self.pop_stack().get_string()) {
875-
self.log_print(format!("エラー! {}", err));
875+
self.log_print(format!("エラー! {}\n", err));
876876
}
877877
}
878878

@@ -888,13 +888,16 @@ impl Executor {
888888
// ファイル一覧のリスト
889889
"ls" => {
890890
if let Ok(entries) = fs::read_dir(".") {
891-
let value: Vec<Type> = entries
892-
.filter_map(|entry| {
893-
entry.ok().and_then(|e| e.file_name().into_string().ok()).map(|x| Type::String(x))
894-
})
895-
.collect();
896-
self.stack.push(Type::List(value));
897-
}
891+
let value: Vec<Type> = entries
892+
.filter_map(|entry| {
893+
entry
894+
.ok()
895+
.and_then(|e| e.file_name().into_string().ok())
896+
.map(|x| Type::String(x))
897+
})
898+
.collect();
899+
self.stack.push(Type::List(value));
900+
}
898901
}
899902

900903
// コマンドとして認識されない場合は文字列とする

0 commit comments

Comments
 (0)