shellmail 1.0.3 ā 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ program
|
|
|
20
20
|
.description("Create a new ShellMail address interactively")
|
|
21
21
|
.option("-l, --local <name>", "Local part of email address")
|
|
22
22
|
.option("-r, --recovery <email>", "Recovery email address")
|
|
23
|
+
.option("-a, --auto", "Auto-generate a random address")
|
|
23
24
|
.action(async (options) => {
|
|
24
25
|
console.log(chalk.bold("\nš§ ShellMail Setup\n"));
|
|
25
26
|
let local = options.local;
|
|
@@ -44,14 +45,20 @@ program
|
|
|
44
45
|
// Loop until we get a valid address
|
|
45
46
|
const api = new ShellMailAPI();
|
|
46
47
|
let result = null;
|
|
48
|
+
// If --auto flag, skip the name prompt
|
|
49
|
+
if (options.auto) {
|
|
50
|
+
local = "auto";
|
|
51
|
+
}
|
|
47
52
|
while (!result) {
|
|
48
53
|
if (!local) {
|
|
49
54
|
const answers = await inquirer.prompt([
|
|
50
55
|
{
|
|
51
56
|
type: "input",
|
|
52
57
|
name: "local",
|
|
53
|
-
message: `Choose your address:\n ${chalk.gray("_")}${chalk.cyan("@shellmail.ai")}\n `,
|
|
58
|
+
message: `Choose your address (or type "auto" for random):\n ${chalk.gray("_")}${chalk.cyan("@shellmail.ai")}\n `,
|
|
54
59
|
validate: (input) => {
|
|
60
|
+
if (input === "auto")
|
|
61
|
+
return true;
|
|
55
62
|
if (!input || input.length < 2)
|
|
56
63
|
return "Must be at least 2 characters";
|
|
57
64
|
if (!/^[a-z0-9][a-z0-9._-]*[a-z0-9]$/i.test(input) && input.length > 2) {
|