-
Notifications
You must be signed in to change notification settings - Fork 33
[Improvement] Initial value for input #95
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
pub fn prompt_tags(_initial: &[String]) -> io::Result<Vec<String>> {
let res: String = cliclack::input("Enter tags (one per line):")
.multiline()
.validate_interactively(|s: &String| {
for (i, line) in s.lines().enumerate() {
if line.is_empty() {
return Err(format!("line {} is empty", i + 1));
}
if !line.is_ascii() {
return Err(format!("line {} contains non-ascii characters", i + 1));
}
}
// .initial_input(&initial.join("\n"))
Ok(())
})
.interact()?;
Ok(res.lines().map(|s| s.to_string()).collect())
}
example use case ^: would allow editing with input.
I imagine it would override placeholder and default_value if nonempty.
it's a nice to have on a project of mine so very low priority for me to fork and implement currently, but if it fits the theme of the project id be interested in bumping it up and submitting a pr.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request