1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use TokenStream;
use ;
/// Derive macro for making enums selectable in inquire prompts.
///
/// This macro generates `select()` and `multi_select()` methods for enums,
/// allowing them to be used directly with inquire's Select and MultiSelect prompts.
/// The methods return the prompt builders, allowing for further customization.
///
/// The enum must implement `Display`, `Debug`, `Copy`, `Clone`, and be `'static`.
///
/// # Example
///
/// ```ignore
/// use inquire_derive::Selectable;
/// use std::fmt::{Display, Formatter};
///
/// #[derive(Debug, Copy, Clone, Selectable)]
/// enum Color {
/// Red,
/// Green,
/// Blue,
/// }
///
/// impl Display for Color {
/// fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
/// write!(f, "{:?}", self)
/// }
/// }
///
/// // Usage:
/// // let color = Color::select("Choose a color:").prompt()?;
/// //
/// // With customization:
/// // let color = Color::select("Choose a color:")
/// // .with_help_message("Use arrow keys to navigate")
/// // .prompt()?;
/// //
/// // Multi-select:
/// // let colors = Color::multi_select("Choose colors:").prompt()?;
/// ```