Skip to content

Commit ab69128

Browse files
feat: remove comments from config after a host (#122)
Co-authored-by: Nathanael Demacon <[email protected]>
1 parent 0ec119f commit ab69128

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ssh_config/parser.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,13 @@ impl Parser {
6464

6565
let mut line = String::new();
6666
while reader.read_line(&mut line)? > 0 {
67-
line = line.trim().to_string();
67+
// We separate parts that contain comments with #
68+
line = if line.contains('#') {
69+
line.split('#').next().unwrap().to_string()
70+
} else {
71+
line.trim().to_string()
72+
};
73+
6874
if line.is_empty() || line.starts_with('#') {
6975
line.clear();
7076
continue;

0 commit comments

Comments
 (0)