Projekte
Auf GitHub ansehen
vercel/email-prompt
Über uns
CLI email prompt with autocompletion and built-in validation
Produktivität und AutomatisierungGemessener Sternzuwachs
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- -1
- in 1 month
- Verlauf wird gesammelt
Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.
README.md
Originalemail-prompt
CLI email prompt featuring autocompletion and validation.
Powers vercel --login.

Usage
import emailPrompt from 'email-prompt';
let email;
try {
email = await emailPrompt({
/* options */
});
} catch (err) {
console.log('\n> Aborted!');
return;
}
console.log('\n> Hello ' + email);
To run the demo, clone the project and run:
npm install
node demo
Options
start(String): the beginning of the prompt. Defaults to> Enter your email:domains(Set): domain names to autocomplete (asString). Defaults to:aol.comgmail.comgoogle.comyahoo.comymail.comhotmail.comlive.comoutlook.cominbox.commail.comgmx.comicloud.comhey.comzeit.covercel.com
forceLowerCase(Boolean): converts all input to lowercase. Defaults totrue.suggestionColor(String): a chalk color. Defaults tograyautocompleteChars(Set): a set of chars that trigger autocompletion. Defaults to:- ↹ Tab
- ↵ Return (enter)
- → Right arrow
resolveChars(Set): a set of chars that resolve the promise. Defaults to ↵returnabortChars(Set): a set of chars that abort the process. Defaults to Ctrl+CallowInvalidChars(Boolean): controls whether non-email chars are accepted. Defaults tofalse
Notes
Some important implementation details:
email-promptautomatically adapts the mode ofprocess.stdinfor you.- The
stdinstream isresumed andpaused upon the promise being settled. - When the promise resolves or rejects, the previous stdin mode is restored.
- The
ttymode is set toraw, which means all the caret interactions that you come to expect in a regularstdinprompt are simulated. This gives us fine-grained control over the output and powers the validation.
Authors
- Guillermo Rauch (@rauchg) - Vercel
- Leo Lamprecht (@notquiteleo) - Vercel
Ähnliche Projekte entdecken
Wird geladen…