upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/cli_interactor.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli_interactor.rs')
-rw-r--r--src/cli_interactor.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/cli_interactor.rs b/src/cli_interactor.rs
index e52cefb..c6cd4e5 100644
--- a/src/cli_interactor.rs
+++ b/src/cli_interactor.rs
@@ -40,6 +40,8 @@ impl InteractorPrompt for Interactor {
40 } 40 }
41 fn choice(&self, parms: PromptChoiceParms) -> Result<usize> { 41 fn choice(&self, parms: PromptChoiceParms) -> Result<usize> {
42 dialoguer::Select::with_theme(&self.theme) 42 dialoguer::Select::with_theme(&self.theme)
43 .with_prompt(parms.prompt)
44 .report(parms.report)
43 .items(&parms.choices) 45 .items(&parms.choices)
44 .interact() 46 .interact()
45 .context("failed to get choice") 47 .context("failed to get choice")
@@ -96,13 +98,20 @@ impl PromptConfirmParms {
96pub struct PromptChoiceParms { 98pub struct PromptChoiceParms {
97 pub prompt: String, 99 pub prompt: String,
98 pub choices: Vec<String>, 100 pub choices: Vec<String>,
101 pub report: bool,
99} 102}
100 103
101impl PromptChoiceParms { 104impl PromptChoiceParms {
102 pub fn with_prompt<S: Into<String>>(mut self, prompt: S) -> Self { 105 pub fn with_prompt<S: Into<String>>(mut self, prompt: S) -> Self {
103 self.prompt = prompt.into(); 106 self.prompt = prompt.into();
107 self.report = true;
104 self 108 self
105 } 109 }
110
111 // pub fn dont_report(mut self) -> Self {
112 // self.report = false;
113 // self
114 // }
106 pub fn with_choices(mut self, choices: Vec<String>) -> Self { 115 pub fn with_choices(mut self, choices: Vec<String>) -> Self {
107 self.choices = choices; 116 self.choices = choices;
108 self 117 self