@mailmodo/cli 0.0.56-beta.pr58.105 → 0.0.56-beta.pr58.107
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/lib/commands/report/prompt.js +7 -5
- package/dist/lib/config.d.ts +2 -0
- package/dist/lib/config.js +19 -10
- package/oclif.manifest.json +45 -45
- package/package.json +1 -1
|
@@ -71,10 +71,12 @@ export async function promptReportFlags(flags) {
|
|
|
71
71
|
default: flags.output,
|
|
72
72
|
message: 'Output mode:',
|
|
73
73
|
});
|
|
74
|
-
const groupBy =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
const groupBy = output === 'summary'
|
|
75
|
+
? await select({
|
|
76
|
+
choices: GROUP_BY_CHOICES,
|
|
77
|
+
default: flags['group-by'],
|
|
78
|
+
message: 'Group by:',
|
|
79
|
+
})
|
|
80
|
+
: 'none';
|
|
79
81
|
return { ...flags, ...timeRange, 'group-by': groupBy, output };
|
|
80
82
|
}
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export declare function saveConfig(config: MailmodoConfig): Promise<void>;
|
|
|
28
28
|
export declare function clearConfig(): Promise<void>;
|
|
29
29
|
/**
|
|
30
30
|
* Returns the absolute path to the Mailmodo config directory (~/.mailmodo).
|
|
31
|
+
* Honors MAILMODO_CONFIG_DIR env var when set (used in tests to redirect away
|
|
32
|
+
* from the user's real config).
|
|
31
33
|
*
|
|
32
34
|
* @returns {string} The config directory path.
|
|
33
35
|
*/
|
package/dist/lib/config.js
CHANGED
|
@@ -2,8 +2,12 @@ import { existsSync } from 'node:fs';
|
|
|
2
2
|
import { mkdir, readFile, unlink, writeFile } from 'node:fs/promises';
|
|
3
3
|
import { homedir } from 'node:os';
|
|
4
4
|
import { join } from 'node:path';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
function configDir() {
|
|
6
|
+
return process.env.MAILMODO_CONFIG_DIR ?? join(homedir(), '.mailmodo');
|
|
7
|
+
}
|
|
8
|
+
function configFile() {
|
|
9
|
+
return join(configDir(), 'config');
|
|
10
|
+
}
|
|
7
11
|
/**
|
|
8
12
|
* Loads the Mailmodo CLI configuration from ~/.mailmodo/config.
|
|
9
13
|
* The config file stores the API key and account metadata as JSON.
|
|
@@ -13,10 +17,11 @@ const CONFIG_FILE = join(CONFIG_DIR, 'config');
|
|
|
13
17
|
* or null if the config file does not exist or is corrupted.
|
|
14
18
|
*/
|
|
15
19
|
export async function loadConfig() {
|
|
16
|
-
|
|
20
|
+
const file = configFile();
|
|
21
|
+
if (!existsSync(file))
|
|
17
22
|
return null;
|
|
18
23
|
try {
|
|
19
|
-
const content = await readFile(
|
|
24
|
+
const content = await readFile(file, 'utf8');
|
|
20
25
|
return JSON.parse(content);
|
|
21
26
|
}
|
|
22
27
|
catch {
|
|
@@ -32,20 +37,22 @@ export async function loadConfig() {
|
|
|
32
37
|
* at minimum an apiKey. Optional fields: email, totalFreeRemaining.
|
|
33
38
|
*/
|
|
34
39
|
export async function saveConfig(config) {
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
const dir = configDir();
|
|
41
|
+
if (!existsSync(dir)) {
|
|
42
|
+
await mkdir(dir, { recursive: true });
|
|
37
43
|
}
|
|
38
|
-
await writeFile(
|
|
44
|
+
await writeFile(configFile(), JSON.stringify(config, null, 2));
|
|
39
45
|
}
|
|
40
46
|
/**
|
|
41
47
|
* Deletes the saved CLI config file (~/.mailmodo/config), removing the stored API key.
|
|
42
48
|
* No-op if the file does not exist.
|
|
43
49
|
*/
|
|
44
50
|
export async function clearConfig() {
|
|
45
|
-
|
|
51
|
+
const file = configFile();
|
|
52
|
+
if (!existsSync(file))
|
|
46
53
|
return;
|
|
47
54
|
try {
|
|
48
|
-
await unlink(
|
|
55
|
+
await unlink(file);
|
|
49
56
|
}
|
|
50
57
|
catch {
|
|
51
58
|
// Ignore missing file or permission errors; caller can treat as best-effort sign-out.
|
|
@@ -53,9 +60,11 @@ export async function clearConfig() {
|
|
|
53
60
|
}
|
|
54
61
|
/**
|
|
55
62
|
* Returns the absolute path to the Mailmodo config directory (~/.mailmodo).
|
|
63
|
+
* Honors MAILMODO_CONFIG_DIR env var when set (used in tests to redirect away
|
|
64
|
+
* from the user's real config).
|
|
56
65
|
*
|
|
57
66
|
* @returns {string} The config directory path.
|
|
58
67
|
*/
|
|
59
68
|
export function getConfigDir() {
|
|
60
|
-
return
|
|
69
|
+
return configDir();
|
|
61
70
|
}
|
package/oclif.manifest.json
CHANGED
|
@@ -380,6 +380,45 @@
|
|
|
380
380
|
"index.js"
|
|
381
381
|
]
|
|
382
382
|
},
|
|
383
|
+
"login": {
|
|
384
|
+
"aliases": [],
|
|
385
|
+
"args": {},
|
|
386
|
+
"description": "Authenticate with Mailmodo using your API key",
|
|
387
|
+
"examples": [
|
|
388
|
+
"<%= config.bin %> login",
|
|
389
|
+
"MAILMODO_API_KEY=YOUR_API_KEY <%= config.bin %> login"
|
|
390
|
+
],
|
|
391
|
+
"flags": {
|
|
392
|
+
"json": {
|
|
393
|
+
"description": "Output as JSON",
|
|
394
|
+
"name": "json",
|
|
395
|
+
"allowNo": false,
|
|
396
|
+
"type": "boolean"
|
|
397
|
+
},
|
|
398
|
+
"yes": {
|
|
399
|
+
"char": "y",
|
|
400
|
+
"description": "Skip confirmation prompts",
|
|
401
|
+
"name": "yes",
|
|
402
|
+
"allowNo": false,
|
|
403
|
+
"type": "boolean"
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
"hasDynamicHelp": false,
|
|
407
|
+
"hiddenAliases": [],
|
|
408
|
+
"id": "login",
|
|
409
|
+
"pluginAlias": "@mailmodo/cli",
|
|
410
|
+
"pluginName": "@mailmodo/cli",
|
|
411
|
+
"pluginType": "core",
|
|
412
|
+
"strict": true,
|
|
413
|
+
"enableJsonFlag": false,
|
|
414
|
+
"isESM": true,
|
|
415
|
+
"relativePath": [
|
|
416
|
+
"dist",
|
|
417
|
+
"commands",
|
|
418
|
+
"login",
|
|
419
|
+
"index.js"
|
|
420
|
+
]
|
|
421
|
+
},
|
|
383
422
|
"init": {
|
|
384
423
|
"aliases": [],
|
|
385
424
|
"args": {},
|
|
@@ -426,13 +465,12 @@
|
|
|
426
465
|
"index.js"
|
|
427
466
|
]
|
|
428
467
|
},
|
|
429
|
-
"
|
|
468
|
+
"logout": {
|
|
430
469
|
"aliases": [],
|
|
431
470
|
"args": {},
|
|
432
|
-
"description": "
|
|
471
|
+
"description": "Sign out by removing saved credentials from this machine",
|
|
433
472
|
"examples": [
|
|
434
|
-
"<%= config.bin %>
|
|
435
|
-
"MAILMODO_API_KEY=YOUR_API_KEY <%= config.bin %> login"
|
|
473
|
+
"<%= config.bin %> logout"
|
|
436
474
|
],
|
|
437
475
|
"flags": {
|
|
438
476
|
"json": {
|
|
@@ -451,7 +489,7 @@
|
|
|
451
489
|
},
|
|
452
490
|
"hasDynamicHelp": false,
|
|
453
491
|
"hiddenAliases": [],
|
|
454
|
-
"id": "
|
|
492
|
+
"id": "logout",
|
|
455
493
|
"pluginAlias": "@mailmodo/cli",
|
|
456
494
|
"pluginName": "@mailmodo/cli",
|
|
457
495
|
"pluginType": "core",
|
|
@@ -461,7 +499,7 @@
|
|
|
461
499
|
"relativePath": [
|
|
462
500
|
"dist",
|
|
463
501
|
"commands",
|
|
464
|
-
"
|
|
502
|
+
"logout",
|
|
465
503
|
"index.js"
|
|
466
504
|
]
|
|
467
505
|
},
|
|
@@ -535,44 +573,6 @@
|
|
|
535
573
|
"index.js"
|
|
536
574
|
]
|
|
537
575
|
},
|
|
538
|
-
"logout": {
|
|
539
|
-
"aliases": [],
|
|
540
|
-
"args": {},
|
|
541
|
-
"description": "Sign out by removing saved credentials from this machine",
|
|
542
|
-
"examples": [
|
|
543
|
-
"<%= config.bin %> logout"
|
|
544
|
-
],
|
|
545
|
-
"flags": {
|
|
546
|
-
"json": {
|
|
547
|
-
"description": "Output as JSON",
|
|
548
|
-
"name": "json",
|
|
549
|
-
"allowNo": false,
|
|
550
|
-
"type": "boolean"
|
|
551
|
-
},
|
|
552
|
-
"yes": {
|
|
553
|
-
"char": "y",
|
|
554
|
-
"description": "Skip confirmation prompts",
|
|
555
|
-
"name": "yes",
|
|
556
|
-
"allowNo": false,
|
|
557
|
-
"type": "boolean"
|
|
558
|
-
}
|
|
559
|
-
},
|
|
560
|
-
"hasDynamicHelp": false,
|
|
561
|
-
"hiddenAliases": [],
|
|
562
|
-
"id": "logout",
|
|
563
|
-
"pluginAlias": "@mailmodo/cli",
|
|
564
|
-
"pluginName": "@mailmodo/cli",
|
|
565
|
-
"pluginType": "core",
|
|
566
|
-
"strict": true,
|
|
567
|
-
"enableJsonFlag": false,
|
|
568
|
-
"isESM": true,
|
|
569
|
-
"relativePath": [
|
|
570
|
-
"dist",
|
|
571
|
-
"commands",
|
|
572
|
-
"logout",
|
|
573
|
-
"index.js"
|
|
574
|
-
]
|
|
575
|
-
},
|
|
576
576
|
"preview": {
|
|
577
577
|
"aliases": [],
|
|
578
578
|
"args": {
|
|
@@ -932,5 +932,5 @@
|
|
|
932
932
|
]
|
|
933
933
|
}
|
|
934
934
|
},
|
|
935
|
-
"version": "0.0.56-beta.pr58.
|
|
935
|
+
"version": "0.0.56-beta.pr58.107"
|
|
936
936
|
}
|
package/package.json
CHANGED