View-name completion candidates matching `prefix`, sorted. Pure over the repository so it can be unit-tested without the shell completion machinery.
(repo: &Repository, prefix: &str)
| 32 | /// Pure over the repository so it can be unit-tested without the shell |
| 33 | /// completion machinery. |
| 34 | pub(crate) fn view_name_candidates(repo: &Repository, prefix: &str) -> Vec<String> { |
| 35 | let mut names = match repo.list_views() { |
| 36 | Ok(v) => v, |
| 37 | Err(_) => return Vec::new(), |
| 38 | }; |
| 39 | names.retain(|n| n.starts_with(prefix)); |
| 40 | names.sort(); |
| 41 | names |
| 42 | } |
| 43 | |
| 44 | /// Change-hash completion candidates drawn from the change store. |
| 45 | /// |