mu-wizard

shell script to easily configure mu4e accounts on Emacs
git clone git://git.ckyln.com/~cem/mu-wizard
Log | Files | Refs | LICENSE

commit f45e8761e0e3c37cf893e5ea20935fe2ccc1e4be
parent 25046e4670a5d5cac2c806b9f8b191918942fa84
Author: Cem Keylan <cem@ckyln.com>
Date:   Fri,  6 Nov 2020 15:01:06 +0300

prompt_required(): add a prompt() wrapper that requires input

Diffstat:
Mbin/muw | 15++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/bin/muw b/bin/muw @@ -12,6 +12,14 @@ prompt() { read -r ans || return printf %s "$ans" } +prompt_required() { + promptout=''; promptout=$(prompt "$@") + until [ "$promptout" ]; do + out "This is required." + promptout=$(prompt "$@") + done + printf %s "$promptout" +} prompt_noecho() { # This is the same with the prompt() function except that it doesn't echo # the user input to the terminal. It can be used to ask for passwords and @@ -220,7 +228,7 @@ get_information() { sslcert=$file; break done - fulladdr=$(prompt Email \ + fulladdr=$(prompt_required Email \ "Insert the email address that you want to configure for mu4e") # Check the override directory for possible alterations of the @@ -263,12 +271,13 @@ get_information() { realname=$(prompt "Real name" \ "Enter your full name you want to be identified on this account.") - title=$(prompt "Account name" \ + title=$(prompt_required "Account name" \ "Enter a short, one-word identifier for this email account that will" \ "distinguish them from any other accounts you add") while contains "$title" "$profiles"; do - title=$(prompt "Account name" \ + out "The title '$title' is already used." + title=$(prompt_required "Account name" \ "Enter a short, one-word identifier for this email account that will" \ "distinguish them from any other accounts you add") done