mirror of
https://github.com/denisidoro/navi
synced 2024-11-22 11:33:10 +00:00
Reduce lines of code
This commit is contained in:
parent
6dcbcfea54
commit
43d16025d2
1 changed files with 3 additions and 9 deletions
|
@ -149,9 +149,7 @@ pub fn read_lines(
|
||||||
}
|
}
|
||||||
// tag
|
// tag
|
||||||
else if line.starts_with('%') {
|
else if line.starts_with('%') {
|
||||||
if write_cmd(&tags, &comment, &snippet, writer, stdin).is_err() {
|
should_break = write_cmd(&tags, &comment, &snippet, writer, stdin).is_err();
|
||||||
should_break = true
|
|
||||||
}
|
|
||||||
snippet = String::from("");
|
snippet = String::from("");
|
||||||
tags = without_prefix(&line);
|
tags = without_prefix(&line);
|
||||||
}
|
}
|
||||||
|
@ -165,17 +163,13 @@ pub fn read_lines(
|
||||||
}
|
}
|
||||||
// comment
|
// comment
|
||||||
else if line.starts_with('#') {
|
else if line.starts_with('#') {
|
||||||
if write_cmd(&tags, &comment, &snippet, writer, stdin).is_err() {
|
should_break = write_cmd(&tags, &comment, &snippet, writer, stdin).is_err();
|
||||||
should_break = true
|
|
||||||
}
|
|
||||||
snippet = String::from("");
|
snippet = String::from("");
|
||||||
comment = without_prefix(&line);
|
comment = without_prefix(&line);
|
||||||
}
|
}
|
||||||
// variable
|
// variable
|
||||||
else if line.starts_with('$') {
|
else if line.starts_with('$') {
|
||||||
if write_cmd(&tags, &comment, &snippet, writer, stdin).is_err() {
|
should_break = write_cmd(&tags, &comment, &snippet, writer, stdin).is_err();
|
||||||
should_break = true
|
|
||||||
}
|
|
||||||
snippet = String::from("");
|
snippet = String::from("");
|
||||||
let (variable, command, opts) = parse_variable_line(&line)
|
let (variable, command, opts) = parse_variable_line(&line)
|
||||||
.with_context(|| format!("Failed to parse variable line. See line number {} in cheatsheet `{}`", line_nr + 1, id))?;
|
.with_context(|| format!("Failed to parse variable line. See line number {} in cheatsheet `{}`", line_nr + 1, id))?;
|
||||||
|
|
Loading…
Reference in a new issue