Skip to content

Commit 62750f0

Browse files
committed
feat(repl): 添加注释行跳过功能
- 在 REPL 中忽略以 # 开头的注释行
1 parent e2effe3 commit 62750f0

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

file_classification_cli/src/repl.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ pub fn run_repl(
6767
print!("\x1B[2J\x1B[1;1H"); // 清屏
6868
continue;
6969
}
70+
71+
// 跳过注释行
72+
if line.starts_with("#") {
73+
continue;
74+
}
75+
7076
if line.starts_with("!") && line.len() > 1 {
7177
// 执行系统命令
7278
let cmd = &line[1..];
@@ -125,4 +131,4 @@ pub fn run_repl(
125131
// 保存历史记录
126132
let _ = rl.save_history(history_path);
127133
Ok(())
128-
}
134+
}

0 commit comments

Comments
 (0)