Author:
Hash:
Timestamp:
+21 -12 +/-1 browse
Kevin Schoon [me@kevinschoon.com]
f9b4b76854d17effa4c25adba6d2f7dd50ccdc39
Mon, 04 Aug 2025 12:03:34 +0000 (3 months ago)
| 1 | diff --git a/ayllu-shell/src/ui.rs b/ayllu-shell/src/ui.rs |
| 2 | index 9adeb54..c47fbb1 100644 |
| 3 | --- a/ayllu-shell/src/ui.rs |
| 4 | +++ b/ayllu-shell/src/ui.rs |
| 5 | @@ -204,17 +204,22 @@ mod menu { |
| 6 | .iter() |
| 7 | .map(|other| Item::Collection(other)) |
| 8 | .collect(); |
| 9 | - match default_menu!("Select a Collection >", items.as_slice()) { |
| 10 | - Some(choice) => { |
| 11 | - let choice = items.get(choice).unwrap(); |
| 12 | - match choice { |
| 13 | - Item::Collection(collection) => collections |
| 14 | - .iter() |
| 15 | - .find(|other| other.name == collection.name), |
| 16 | - _ => unreachable!(), |
| 17 | + if items.is_empty() { |
| 18 | + println!("No collections are configured"); |
| 19 | + None |
| 20 | + } else { |
| 21 | + match default_menu!("Select a Collection >", items.as_slice()) { |
| 22 | + Some(choice) => { |
| 23 | + let choice = items.get(choice).unwrap(); |
| 24 | + match choice { |
| 25 | + Item::Collection(collection) => collections |
| 26 | + .iter() |
| 27 | + .find(|other| other.name == collection.name), |
| 28 | + _ => unreachable!(), |
| 29 | + } |
| 30 | } |
| 31 | + None => None, |
| 32 | } |
| 33 | - None => None, |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | @@ -346,9 +351,13 @@ impl Prompt<'_> { |
| 38 | path: repo.path.clone(), |
| 39 | }) |
| 40 | .collect(); |
| 41 | - match default_menu!("Select a Repsoitory >", repositories.as_slice()) { |
| 42 | - Some(choice) => self.execute(repositories.get(choice), item), |
| 43 | - None => self.execute(None, None), |
| 44 | + if repositories.is_empty() { |
| 45 | + self.execute(None, None) |
| 46 | + } else { |
| 47 | + match default_menu!("Select a Repsoitory >", repositories.as_slice()) { |
| 48 | + Some(choice) => self.execute(repositories.get(choice), item), |
| 49 | + None => self.execute(None, None), |
| 50 | + } |
| 51 | } |
| 52 | } |
| 53 | Some(menu::Item::Move { collection, name }) => { |