Don't resolve name when it isn't unique
This commit is contained in:
parent
9a3004557f
commit
3f2b3d2f73
1 changed files with 10 additions and 2 deletions
|
|
@ -38,10 +38,18 @@ impl State {
|
||||||
|
|
||||||
// Otherwise, interpret the identifier as a repo name and find the
|
// Otherwise, interpret the identifier as a repo name and find the
|
||||||
// corresponding id.
|
// corresponding id.
|
||||||
self.repos
|
let matching = self
|
||||||
|
.repos
|
||||||
.iter()
|
.iter()
|
||||||
.find(|(_, name)| *name == identifier)
|
.filter(|(_, name)| *name == identifier)
|
||||||
.map(|(id, _)| *id)
|
.map(|(id, _)| *id)
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
match matching.first() {
|
||||||
|
None => None,
|
||||||
|
Some(_) if matching.len() > 1 => None,
|
||||||
|
Some(id) => Some(*id),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue