diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/cli_interactor.rs | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/src/lib/cli_interactor.rs b/src/lib/cli_interactor.rs index e6154a2..2ceb088 100644 --- a/src/lib/cli_interactor.rs +++ b/src/lib/cli_interactor.rs | |||
| @@ -71,7 +71,6 @@ impl InteractorPrompt for Interactor { | |||
| 71 | } | 71 | } |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | #[derive(Default)] | ||
| 75 | pub struct PromptInputParms { | 74 | pub struct PromptInputParms { |
| 76 | pub prompt: String, | 75 | pub prompt: String, |
| 77 | pub default: String, | 76 | pub default: String, |
| @@ -79,6 +78,17 @@ pub struct PromptInputParms { | |||
| 79 | pub optional: bool, | 78 | pub optional: bool, |
| 80 | } | 79 | } |
| 81 | 80 | ||
| 81 | impl Default for PromptInputParms { | ||
| 82 | fn default() -> Self { | ||
| 83 | Self { | ||
| 84 | prompt: String::new(), | ||
| 85 | default: String::new(), | ||
| 86 | optional: false, | ||
| 87 | report: true, | ||
| 88 | } | ||
| 89 | } | ||
| 90 | } | ||
| 91 | |||
| 82 | impl PromptInputParms { | 92 | impl PromptInputParms { |
| 83 | pub fn with_prompt<S: Into<String>>(mut self, prompt: S) -> Self { | 93 | pub fn with_prompt<S: Into<String>>(mut self, prompt: S) -> Self { |
| 84 | self.prompt = prompt.into(); | 94 | self.prompt = prompt.into(); |
| @@ -99,13 +109,22 @@ impl PromptInputParms { | |||
| 99 | } | 109 | } |
| 100 | } | 110 | } |
| 101 | 111 | ||
| 102 | #[derive(Default)] | ||
| 103 | pub struct PromptPasswordParms { | 112 | pub struct PromptPasswordParms { |
| 104 | pub prompt: String, | 113 | pub prompt: String, |
| 105 | pub confirm: bool, | 114 | pub confirm: bool, |
| 106 | pub report: bool, | 115 | pub report: bool, |
| 107 | } | 116 | } |
| 108 | 117 | ||
| 118 | impl Default for PromptPasswordParms { | ||
| 119 | fn default() -> Self { | ||
| 120 | Self { | ||
| 121 | prompt: String::new(), | ||
| 122 | confirm: false, | ||
| 123 | report: true, | ||
| 124 | } | ||
| 125 | } | ||
| 126 | } | ||
| 127 | |||
| 109 | impl PromptPasswordParms { | 128 | impl PromptPasswordParms { |
| 110 | pub fn with_prompt<S: Into<String>>(mut self, prompt: S) -> Self { | 129 | pub fn with_prompt<S: Into<String>>(mut self, prompt: S) -> Self { |
| 111 | self.prompt = prompt.into(); | 130 | self.prompt = prompt.into(); |
| @@ -138,7 +157,6 @@ impl PromptConfirmParms { | |||
| 138 | } | 157 | } |
| 139 | } | 158 | } |
| 140 | 159 | ||
| 141 | #[derive(Default)] | ||
| 142 | pub struct PromptChoiceParms { | 160 | pub struct PromptChoiceParms { |
| 143 | pub prompt: String, | 161 | pub prompt: String, |
| 144 | pub choices: Vec<String>, | 162 | pub choices: Vec<String>, |
| @@ -146,6 +164,17 @@ pub struct PromptChoiceParms { | |||
| 146 | pub report: bool, | 164 | pub report: bool, |
| 147 | } | 165 | } |
| 148 | 166 | ||
| 167 | impl Default for PromptChoiceParms { | ||
| 168 | fn default() -> Self { | ||
| 169 | Self { | ||
| 170 | prompt: String::new(), | ||
| 171 | choices: vec![], | ||
| 172 | default: None, | ||
| 173 | report: true, | ||
| 174 | } | ||
| 175 | } | ||
| 176 | } | ||
| 177 | |||
| 149 | impl PromptChoiceParms { | 178 | impl PromptChoiceParms { |
| 150 | pub fn with_prompt<S: Into<String>>(mut self, prompt: S) -> Self { | 179 | pub fn with_prompt<S: Into<String>>(mut self, prompt: S) -> Self { |
| 151 | self.prompt = prompt.into(); | 180 | self.prompt = prompt.into(); |