This is a small helper used by the GoFigr configuration wizard to collect user input interactively. When a validation function is supplied, the input will be repeatedly requested until it passes validation or the maximum number of attempts is reached.
read_prompt(prompt, validate = NULL, attempt = 1, max_attempts = 2)The raw input string, or the result of `validate(input)` if a validation function is supplied.
Character string shown to the user, e.g. "Enter username: ".
Optional function taking a single character argument and either returning a transformed value or throwing an error if the value is invalid.
Current attempt number (used internally for recursion).
Maximum number of attempts before giving up and throwing an error.