Skip to content

Commit

Permalink
Allow spaces when parsing comma-delimited strings
Browse files Browse the repository at this point in the history
  • Loading branch information
rrwick committed Jan 8, 2025
1 parent 39f4c2b commit 8f58861
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ fn parse_remove_tigs(remove: Option<String>) -> Vec<u32> {
if remove.is_none() {
return Vec::new();
}
let mut remove_tigs: Vec<_> = remove.unwrap().split(',')
let remove = remove.unwrap().replace(' ', "");
let mut remove_tigs: Vec<_> = remove.split(',')
.map(|s| s.parse::<u32>().unwrap_or_else(|_| quit_with_error(
&format!("failed to parse '{}' as a node number", s)))).collect();
remove_tigs.sort();
Expand Down
3 changes: 2 additions & 1 deletion src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,8 @@ fn parse_manual_clusters(manual_clusters: Option<String>) -> Vec<u16> {
if manual_clusters.is_none() {
return Vec::new();
}
let mut clusters: Vec<_> = manual_clusters.unwrap().split(',')
let manual_clusters = manual_clusters.unwrap().replace(' ', "");
let mut clusters: Vec<_> = manual_clusters.split(',')
.map(|s| s.parse::<u16>().unwrap_or_else(|_| quit_with_error(
&format!("failed to parse '{}' as a node number", s)))).collect();
clusters.sort();
Expand Down

0 comments on commit 8f58861

Please sign in to comment.