Skip to content

Commit

Permalink
Don't hardcode split char in the error message (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
oren0e authored Jul 11, 2022
1 parent 5074760 commit 378c43e
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/match_logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,24 @@ pub fn parse_path_and_line_arg(arg: &str, split_char: char) -> AnyhowResult<File
let mut iterator = arg.split(split_char);
let file_at_line = FileAtLine::new(
iterator.next().ok_or_else(|| {
anyhow!("Error parsing input. Format is <path-to-file>:<line-number>")
anyhow!(format!(
"Error parsing input. Format is <path-to-file>{}<line-number>",
split_char
))
})?,
iterator.next().ok_or_else(|| {
anyhow!("Error parsing input. Format is <path-to-file>:<line-number>")
anyhow!(format!(
"Error parsing input. Format is <path-to-file>{}<line-number>",
split_char
))
})?,
);
return Ok(file_at_line);
}
Err(anyhow!(
"Split character not found! Format is <path-to-file>:<line-number>"
))
Err(anyhow!(format!(
"Split character not found! Format is <path-to-file>{}<line-number>",
split_char
)))
}

fn get_main_branch_name(output: &str) -> AnyhowResult<String> {
Expand Down

0 comments on commit 378c43e

Please sign in to comment.