Conversation
013a535 to
d2e8327
Compare
src/ssh_config/parser.rs
Outdated
|
|
||
| if patterns.contains(&"*".to_string()) { | ||
| global_host = Host::new(patterns.clone()); | ||
| hosts.push(global_host.clone()); |
There was a problem hiding this comment.
This would add an host with patterns but empty entries. I'm not sure if it's needed 🤔 global_host by itself may not be needed as we have current_host now.
src/ssh_config/parser.rs
Outdated
| let mut global_host = Host::new(Vec::new()); | ||
| let mut is_in_host_block = false; | ||
| let mut hosts = Vec::new(); | ||
| let mut current_host: Option<Host> = None; |
There was a problem hiding this comment.
| let mut current_host: Option<Host> = None; | |
| let mut current_host = Host::new(vec!["*".to_string()]); |
current_host is the global host by default. What about this?
d2e8327 to
50da653
Compare
|
@quantumsheep sorry for wasting your time reviewing the previous commit. i think we can simplify this fix to: if !patterns.contains(&"*".to_string()) {
is_in_host_block = true;
hosts.push(Host::new(patterns));
}after this, everything from Offtopic:While working on the task, I discovered a not quite correct behaviour: according to the specification, the entries below cannot overwrite those already declared above. Case:
|
I think it's not right too. What about I think we should just set current host when an host in host is found. Wildcards are handled by What do you think? Really sorry to make you change your code multiple times. |
|
Hey! I took the original idea and simplified it in f04c0b4. Thanks a lot! |
fixes #118
My first experience with Rust. I didn't understand why the InvalidIncludeErrorDetails::HostsInsideHostBlock case is needed, but I can fix the code if you suggest a couple of examples for tests)