upleb.uk

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

summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-05-06 14:51:02 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2025-05-06 14:51:02 +0100
commitd33cb027357c7cc82679548ee999ead2cc2a6ecc (patch)
tree2be08b55caefaf2c0252ee9713b9e4b0d9df1d68
parentb3e5233f6258dd4508d1840b4cb90e1f4f5b6447 (diff)
chore: bump dialoguer v0.11.0
and fix breaking changes
-rw-r--r--Cargo.lock5
-rw-r--r--Cargo.toml2
-rw-r--r--src/lib/cli_interactor.rs27
-rw-r--r--test_utils/Cargo.toml2
4 files changed, 18 insertions, 18 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 103b8c9..50abbc1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -504,13 +504,14 @@ checksum = "2a2330da5de22e8a3cb63252ce2abb30116bf5265e89c0e01bc17015ce30a476"
504 504
505[[package]] 505[[package]]
506name = "dialoguer" 506name = "dialoguer"
507version = "0.10.4" 507version = "0.11.0"
508source = "registry+https://github.com/rust-lang/crates.io-index" 508source = "registry+https://github.com/rust-lang/crates.io-index"
509checksum = "59c6f2989294b9a498d3ad5491a79c6deb604617378e1cdc4bfc1c1361fe2f87" 509checksum = "658bce805d770f407bc62102fca7c2c64ceef2fbcb2b8bd19d2765ce093980de"
510dependencies = [ 510dependencies = [
511 "console", 511 "console",
512 "shell-words", 512 "shell-words",
513 "tempfile", 513 "tempfile",
514 "thiserror 1.0.69",
514 "zeroize", 515 "zeroize",
515] 516]
516 517
diff --git a/Cargo.toml b/Cargo.toml
index baef2a6..5436740 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -18,7 +18,7 @@ auth-git2 = "0.5.4"
18chacha20poly1305 = "0.10.1" 18chacha20poly1305 = "0.10.1"
19clap = { version = "4.3.19", features = ["derive"] } 19clap = { version = "4.3.19", features = ["derive"] }
20console = "0.15.7" 20console = "0.15.7"
21dialoguer = "0.10.4" 21dialoguer = "0.11.0"
22directories = "6.0.0" 22directories = "6.0.0"
23futures = "0.3.28" 23futures = "0.3.28"
24git2 = "0.20.2" 24git2 = "0.20.2"
diff --git a/src/lib/cli_interactor.rs b/src/lib/cli_interactor.rs
index 1b74101..8fca81d 100644
--- a/src/lib/cli_interactor.rs
+++ b/src/lib/cli_interactor.rs
@@ -19,20 +19,21 @@ pub trait InteractorPrompt {
19} 19}
20impl InteractorPrompt for Interactor { 20impl InteractorPrompt for Interactor {
21 fn input(&self, parms: PromptInputParms) -> Result<String> { 21 fn input(&self, parms: PromptInputParms) -> Result<String> {
22 let mut input = Input::with_theme(&self.theme); 22 let mut input = Input::with_theme(&self.theme)
23 input.with_prompt(parms.prompt).allow_empty(parms.optional); 23 .with_prompt(parms.prompt)
24 .allow_empty(parms.optional)
25 .report(parms.report);
24 if !parms.default.is_empty() { 26 if !parms.default.is_empty() {
25 input.default(parms.default); 27 input = input.default(parms.default);
26 } 28 }
27 input.report(parms.report);
28 Ok(input.interact_text()?) 29 Ok(input.interact_text()?)
29 } 30 }
30 fn password(&self, parms: PromptPasswordParms) -> Result<String> { 31 fn password(&self, parms: PromptPasswordParms) -> Result<String> {
31 let mut p = Password::with_theme(&self.theme); 32 let mut p = Password::with_theme(&self.theme)
32 p.with_prompt(parms.prompt); 33 .with_prompt(parms.prompt)
33 p.report(parms.report); 34 .report(parms.report);
34 if parms.confirm { 35 if parms.confirm {
35 p.with_confirmation("confirm password", "passwords didnt match..."); 36 p = p.with_confirmation("confirm password", "passwords didnt match...");
36 } 37 }
37 let pass: String = p.interact()?; 38 let pass: String = p.interact()?;
38 Ok(pass) 39 Ok(pass)
@@ -45,27 +46,25 @@ impl InteractorPrompt for Interactor {
45 Ok(confirm) 46 Ok(confirm)
46 } 47 }
47 fn choice(&self, parms: PromptChoiceParms) -> Result<usize> { 48 fn choice(&self, parms: PromptChoiceParms) -> Result<usize> {
48 let mut choice = dialoguer::Select::with_theme(&self.theme); 49 let mut choice = dialoguer::Select::with_theme(&self.theme)
49 choice
50 .with_prompt(parms.prompt) 50 .with_prompt(parms.prompt)
51 .report(parms.report) 51 .report(parms.report)
52 .items(&parms.choices); 52 .items(&parms.choices);
53 if let Some(default) = parms.default { 53 if let Some(default) = parms.default {
54 if std::env::var("NGITTEST").is_err() { 54 if std::env::var("NGITTEST").is_err() {
55 choice.default(default); 55 choice = choice.default(default);
56 } 56 }
57 } 57 }
58 choice.interact().context("failed to get choice") 58 choice.interact().context("failed to get choice")
59 } 59 }
60 fn multi_choice(&self, parms: PromptMultiChoiceParms) -> Result<Vec<usize>> { 60 fn multi_choice(&self, parms: PromptMultiChoiceParms) -> Result<Vec<usize>> {
61 // the colorful theme is not very clear so falling back to default 61 // the colorful theme is not very clear so falling back to default
62 let mut choice = dialoguer::MultiSelect::default(); 62 let mut choice = dialoguer::MultiSelect::default()
63 choice
64 .with_prompt(parms.prompt) 63 .with_prompt(parms.prompt)
65 .report(parms.report) 64 .report(parms.report)
66 .items(&parms.choices); 65 .items(&parms.choices);
67 if let Some(defaults) = parms.defaults { 66 if let Some(defaults) = parms.defaults {
68 choice.defaults(&defaults); 67 choice = choice.defaults(&defaults);
69 } 68 }
70 choice.interact().context("failed to get choice") 69 choice.interact().context("failed to get choice")
71 } 70 }
diff --git a/test_utils/Cargo.toml b/test_utils/Cargo.toml
index 0888aa6..2001733 100644
--- a/test_utils/Cargo.toml
+++ b/test_utils/Cargo.toml
@@ -6,7 +6,7 @@ edition = "2021"
6[dependencies] 6[dependencies]
7anyhow = "1.0.75" 7anyhow = "1.0.75"
8assert_cmd = "2.0.12" 8assert_cmd = "2.0.12"
9dialoguer = "0.10.4" 9dialoguer = "0.11.0"
10directories = "6.0.0" 10directories = "6.0.0"
11futures = "0.3.28" 11futures = "0.3.28"
12git2 = "0.20.2" 12git2 = "0.20.2"